Переглянути джерело

Merge branch 'master' of shine/esb_chenweifeng into master

esb 9 роки тому
батько
коміт
6308d9dc9a
100 змінених файлів з 2980 додано та 4330 видалено
  1. 35 309
      Hos-Framework/src/main/java/com/yihu/ehr/framework/common/dao/SQLGeneralDAO.java
  2. 0 28
      Hos-Framework/src/main/java/com/yihu/ehr/framework/common/dao/XSQLGeneralDAO.java
  3. 0 81
      Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/Constants.java
  4. 27 128
      Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/ErrorCode.java
  5. 5 5
      Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/TreeView.java
  6. 0 41
      Hos-Framework/src/main/java/com/yihu/ehr/framework/exception/ApiException.java
  7. 0 218
      Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/BeanTransformer.java
  8. 0 106
      Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/RequestParamTransformer.java
  9. 0 317
      Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/SqlCreator.java
  10. 5 7
      Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/thread/UpdateThread.java
  11. 1 1
      Hos-Resource-Mini-Update/src/main/resources/config/serviceAlive.bat
  12. 3 5
      Hos-Resource-Mini-Update/target/classes/config/threadConfig.properties
  13. 6 8
      Hos-Resource-Mini-helper/src/main/java/com.yihu.ehr/thread/LogThread.java
  14. 0 12
      Hos-Resource-Mini-helper/src/main/java/com.yihu.ehr/thread/SQLThread.java
  15. 3 3
      Hos-Resource-Mini-helper/src/main/resources/config/threadConfig.properties
  16. 1 6
      Hos-Resource-Mini/pom.xml
  17. 34 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/ApplicationStart.java
  18. 0 87
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/ThreadStart.java
  19. 224 9
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/config/SysConfig.java
  20. 0 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/config/ThreadConfig.java
  21. 0 20
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/constants/Constants.java
  22. 0 169
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/controller/DataAcquisitionController.java
  23. 2 36
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/controller/SystemController.java
  24. 0 61
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/DataAcquistion.java
  25. 0 57
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/RespResult.java
  26. 0 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/entity/adapter/AdapterDict.java
  27. 1 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/entity/adapter/AdapterMetaData.java
  28. 0 182
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/DataAcquisitionManager.java
  29. 1 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/DatacollectManager.java
  30. 78 108
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/SystemManager.java
  31. 8 40
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/CrawlerManager.java
  32. 10 14
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/DBOrigin.java
  33. 56 15
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/DataCollectDispatcher.java
  34. 0 34
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/intf/IDataAcquisitionManager.java
  35. 1 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/intf/ISystemManager.java
  36. 51 12
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/patient/PatientCDAUpload.java
  37. 157 54
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/standard/StandardManager.java
  38. 0 189
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/standard/StandardService.java
  39. 5 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/CrawlerSupplyThread.java
  40. 6 4
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/CrawlerThread.java
  41. 0 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/StandardUpdateThread.java
  42. 29 58
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/file/FileUtil.java
  43. 58 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpClient.java
  44. 172 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpClientImpl.java
  45. 71 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpsClient.java
  46. 241 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HOPClient.java
  47. 1 1
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HopHostnameVerifier.java
  48. 408 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HttpClientUtil.java
  49. 56 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HttpsInitialise.java
  50. 20 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/IHAHttpClient.java
  51. 20 0
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/Response.java
  52. 37 271
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/EsbHttp.java
  53. 55 38
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HttpClientUtil.java
  54. 6 25
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HttpHelper.java
  55. 2 2
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/Response.java
  56. 0 35
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/json/JSON.java
  57. 0 37
      Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/json/XML2JSON.java
  58. 7 5
      Hos-Resource-Mini/src/main/resources/config/crawler.properties
  59. 2 5
      Hos-Resource-Mini/src/main/resources/config/http.properties
  60. 8 0
      Hos-Resource-Mini/src/main/resources/config/sys.config.xml
  61. 1 1
      Hos-Resource-Mini/src/main/resources/log4j2.xml
  62. 4 3
      Hos-Resource-Mini/src/main/resources/spring/applicationContext.xml
  63. 1 2
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/common/indexJs.jsp
  64. 0 18
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/dataAcquistion.jsp
  65. 0 154
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/dataAcquistionJs.jsp
  66. 0 62
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/editorDataAcq.jsp
  67. 0 97
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/editorDataAcqJs.jsp
  68. 2 2
      Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/system/dataSourceJs.jsp
  69. 11 15
      Hos-Resource-Mini/src/main/webapp/WEB-INF/web.xml
  70. 2 10
      Hos-resource/Hos-Resource.iml
  71. 6 6
      Hos-resource/src/main/java/com/yihu/ehr/datacollect/controller/DataCollectController.java
  72. 4 6
      Hos-resource/src/main/java/com/yihu/ehr/datacollect/service/DatacollectManager.java
  73. 4 4
      Hos-resource/src/main/java/com/yihu/ehr/datacollect/service/DatacollectService.java
  74. 2 0
      Hos-resource/src/main/java/com/yihu/ehr/resource/controller/RsResourceController.java
  75. 2 0
      Hos-resource/src/main/java/com/yihu/ehr/resource/controller/RsResourceRestController.java
  76. 1 1
      Hos-resource/src/main/java/com/yihu/ehr/resource/dao/impl/RsResourceRestDaoImpl.java
  77. 1 1
      Hos-resource/src/main/java/com/yihu/ehr/resource/dao/impl/RsResourceRestDetailDaoImpl.java
  78. 90 110
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/AdapterController.java
  79. 65 61
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/AdapterVersionController.java
  80. 49 40
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/PublisherController.java
  81. 55 44
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeController.java
  82. 83 85
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDatasetController.java
  83. 63 62
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDictController.java
  84. 72 73
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDictEntryController.java
  85. 69 69
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeMetadataController.java
  86. 51 39
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeVersionController.java
  87. 56 44
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StandardController.java
  88. 61 57
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StandardVersionController.java
  89. 70 70
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDatasetController.java
  90. 69 71
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDictController.java
  91. 74 76
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDictEntryController.java
  92. 88 98
      Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdMetadataController.java
  93. 1 18
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDatasetModel.java
  94. 1 1
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/AdapterDictEntryResultDetailModel.java
  95. 1 18
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDictModel.java
  96. 1 20
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDictentryModel.java
  97. 2 11
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/AdapterMetadataResultDetailModel.java
  98. 2 2
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/ApiMetadataResultDetailModel.java
  99. 3 28
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/standard/StandardModel.java
  100. 0 0
      Hos-resource/src/main/java/com/yihu/ehr/standard/model/standard/resultModel/StandardResultDetailModel.java

+ 35 - 309
Hos-Framework/src/main/java/com/yihu/ehr/framework/common/dao/SQLGeneralDAO.java

@ -1,22 +1,7 @@
package com.yihu.ehr.framework.common.dao;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.framework.constrant.Constants;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.exception.ApiException;
import com.yihu.ehr.framework.model.DataGridResult;
import com.yihu.ehr.framework.util.log.LogService;
import com.yihu.ehr.framework.util.operator.CollectionUtil;
import com.yihu.ehr.framework.util.operator.NumberUtil;
import com.yihu.ehr.framework.util.sql.SqlCreator;
import com.yihu.ehr.framework.util.operator.StringUtil;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.jdbc.Work;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
@ -25,12 +10,6 @@ import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -59,7 +38,8 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
        return hibernateTemplate;
    }
    public DataGridResult getDataGridResult(String hql, Integer page, Integer rows) {
    @Override
    public DataGridResult getDataGridResult(String hql, Integer page, Integer rows) throws Exception {
        DataGridResult dataGridResult = new DataGridResult();
@ -85,45 +65,54 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
        return dataGridResult;
    }
    //=========================hibernate start==============================
    public void beginTransaction() {
    @Override
    public void beginTransaction() throws Exception {
        hibernateTemplate.getSessionFactory().getCurrentSession().getTransaction().begin();
    }
    public void commitTransaction() {
    @Override
    public void commitTransaction() throws Exception {
        hibernateTemplate.getSessionFactory().getCurrentSession().getTransaction().commit();
    }
    public void saveEntity(Object entity) {
    @Override
    public void saveEntity(Object entity) throws Exception {
        if (entity == null) return;
        hibernateTemplate.save(entity);
    }
    public void updateEntity(Object entity) {
    @Override
    public void updateEntity(Object entity) throws Exception {
        if (entity == null) return;
        hibernateTemplate.update(entity);
    }
    public void saveOrUpdateEntity(Object entity) {
    @Override
    public void saveOrUpdateEntity(Object entity) throws Exception {
        if (entity == null) return;
        hibernateTemplate.saveOrUpdate(entity);
    }
    public void mergeEntity(Object entity) {
    @Override
    public void mergeEntity(Object entity) throws Exception {
        if (entity == null) return;
        hibernateTemplate.merge(entity);
    }
    public void deleteEntity(Object entity) {
    @Override
    public void deleteEntity(Object entity) throws Exception {
        if (entity == null) return;
        hibernateTemplate.delete(entity);
    }
    public <T> void deleteEntity(Class<T> cls, Serializable id) {
    @Override
    public <T> void deleteEntity(Class<T> cls, Serializable id) throws Exception {
        T obj = (T) hibernateTemplate.load(cls, id);
        hibernateTemplate.delete(obj);
    }
    public <T> T getEntity(Class<T> cls, Serializable id) {
    @Override
    public <T> T getEntity(Class<T> cls, Serializable id) throws Exception {
        return (T) hibernateTemplate.get(cls, id);
    }
    //=========================hibernate end==============================
@ -137,7 +126,8 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryListBySql("select * from person")
     * @author ding
     */
    public List<Map<String, Object>> queryListBySql(String sql) {
    @Override
    public List<Map<String, Object>> queryListBySql(String sql) throws Exception {
        List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql);
        return result;
    }
@ -151,7 +141,8 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryListBySql("select * from person where username=?",new Object[]{"admin"})
     * @author ding
     */
    public List<Map<String, Object>> queryListBySql(String sql, List params) {
    @Override
    public List<Map<String, Object>> queryListBySql(String sql, List params) throws Exception {
        List<Map<String, Object>> result = this.jdbcTemplate.queryForList(sql, params.toArray());
        return result;
    }
@ -165,8 +156,9 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryListBySql("select * from person", Person.class)
     * @author ding
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public <T> List<T> queryListBySql(String sql, Class obj) {
    public <T> List<T> queryListBySql(String sql, Class obj) throws Exception {
        RowMapper rowMapper = (RowMapper) ParameterizedBeanPropertyRowMapper.newInstance(obj);
        List<T> result = this.jdbcTemplate.query(sql, rowMapper);
        return result;
@ -182,8 +174,9 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryListBySql("select * from person where username=?",new Object[]{"admin"},Person.class)
     * @author ding
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public <T> List<T> queryListBySql(String sql, List params, Class obj) {
    public <T> List<T> queryListBySql(String sql, List params, Class obj) throws Exception {
        RowMapper rowMapper = (RowMapper) ParameterizedBeanPropertyRowMapper.newInstance(obj);
        List<T> result = this.jdbcTemplate.query(sql, params.toArray(), rowMapper);
        return result;
@ -199,8 +192,9 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryObjBySql("select * from person where username=?",new Object[]{"admin"},Person.class)
     * @author ding
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public <T> T queryObjBySql(String sql, List params, Class obj) {
    public <T> T queryObjBySql(String sql, List params, Class obj) throws Exception {
        RowMapper rowMapper = (RowMapper) ParameterizedBeanPropertyRowMapper.newInstance(obj);
        Object result = this.jdbcTemplate.queryForObject(sql, params.toArray(), rowMapper);
        return (T) result;
@ -215,8 +209,9 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 例如: queryObjBySql("select * from person where username='admin'",Person.class)
     * @author ding
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public <T> T queryObjBySql(String sql, Class obj) {
    public <T> T queryObjBySql(String sql, Class obj) throws Exception {
        RowMapper rowMapper = (RowMapper) ParameterizedBeanPropertyRowMapper.newInstance(obj);
        Object result = this.jdbcTemplate.queryForObject(sql, rowMapper);
        return (T) result;
@ -225,7 +220,8 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
    /**
     * 获取单列值
     */
    public <T> T scalarBySql(String sql,Class cls) {
    @Override
    public <T> T scalarBySql(String sql,Class cls) throws Exception {
        Object result = this.jdbcTemplate.queryForObject(sql, cls);
        return (T) result;
    }
@ -235,280 +231,10 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
     * 执行SQL语句
     * @return
     */
    @Override
    public void execute(String sql) throws Exception
    {
        this.jdbcTemplate.execute(sql);
    }
    public <T> List getEntityList(Class<T> cls, String hql) {
        Query query = getCurrentSession().createQuery(hql);
        return query.list();
    }
    @Override
    public <T> List getEntityList(Class<T> cls, String condition, String order, Integer limit, Integer offset, ErrorCode errorCode) {
        try {
            Session session = getCurrentSession();
            Criteria criteria = session.createCriteria(cls);
            ObjectMapper objectMapper = new ObjectMapper();
            if (!StringUtil.isEmpty(condition)) {
                JsonNode jsonNode = objectMapper.readTree(condition);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    if (jsonNode.get(fieldName).isInt()) {
                        criteria.add(Restrictions.eq(fieldName, jsonNode.get(fieldName).asInt()));
                    } else {
                        criteria.add(Restrictions.eq(fieldName, jsonNode.get(fieldName).asText()));
                    }
                }
            }
            if (!StringUtil.isEmpty(order)) {
                JsonNode jsonNode = objectMapper.readTree(order);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    String value = jsonNode.get(fieldName).asText().toUpperCase();
                    if (value.equals(Constants.ASC)) {
                        criteria.addOrder(Order.asc(fieldName));
                    } else if (value.equals(Constants.DESC)) {
                        criteria.addOrder(Order.desc(fieldName));
                    }
                }
            }
            if (limit != null) {
                criteria.setMaxResults(limit);
                if (offset != null) {
                    criteria.setFirstResult(offset);
                }
            }
            return criteria.list();
        } catch (Exception e) {
            throw new ApiException(errorCode);
        }
    }
    public <T> List getEntityListByParentId(Class<T> cls, String parentFiledName, Integer patentId, String condition, String order, Integer limit, Integer offset, ErrorCode errorCode) {
        try {
            Session session = getCurrentSession();
            Criteria criteria = session.createCriteria(cls);
            criteria.add(Restrictions.eq(parentFiledName, patentId));
            ObjectMapper objectMapper = new ObjectMapper();
            if (!StringUtil.isEmpty(condition)) {
                JsonNode jsonNode = objectMapper.readTree(condition);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    if (jsonNode.get(fieldName).isInt()) {
                        criteria.add(Restrictions.eq(fieldName, jsonNode.get(fieldName).asInt()));
                    } else {
                        criteria.add(Restrictions.eq(fieldName, jsonNode.get(fieldName).asText()));
                    }
                }
            }
            if (!StringUtil.isEmpty(order)) {
                JsonNode jsonNode = objectMapper.readTree(order);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    String value = jsonNode.get(fieldName).asText().toUpperCase();
                    if (value.equals(Constants.ASC)) {
                        criteria.addOrder(Order.asc(fieldName));
                    } else if (value.equals(Constants.DESC)) {
                        criteria.addOrder(Order.desc(fieldName));
                    }
                }
            }
            if (limit != null) {
                criteria.setMaxResults(limit);
                if (offset != null) {
                    criteria.setFirstResult(offset);
                }
            }
            return criteria.list();
        } catch (Exception e) {
            throw new ApiException(errorCode);
        }
    }
    public List getList(Class tClass, String tableName, String condition, String order, Integer limit, Integer offset, ErrorCode errorCode) {
        SqlCreator sqlCreator = new SqlCreator(tClass);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            if (!StringUtil.isEmpty(condition)) {
                JsonNode jsonNode = objectMapper.readTree(condition);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    String value = jsonNode.get(fieldName).asText();
                    if (NumberUtil.isInteger(value)) {
                        sqlCreator.equalCondition(fieldName, Integer.parseInt(value));
                    } else {
                        sqlCreator.equalCondition(fieldName, value);
                    }
                }
            }
            if (!StringUtil.isEmpty(order)) {
                JsonNode jsonNode = objectMapper.readTree(order);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    String value = jsonNode.get(fieldName).asText().toUpperCase();
                    sqlCreator.order(fieldName, value);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        String sql = sqlCreator.selectData(tableName);
        Query query = getQuery(sqlCreator, sql);
        if (limit != null) {
            query.setMaxResults(limit);
            if (offset != null) {
                query.setFirstResult(offset * limit);
            }
        }
        return query.list();
    }
    public Integer getDataSetInt(Class tClass, String tableName, String condition) {
        SqlCreator sqlCreator = new SqlCreator(tClass);
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            if (!StringUtil.isEmpty(condition)) {
                JsonNode jsonNode = objectMapper.readTree(condition);
                Iterator<String> fieldNames = jsonNode.fieldNames();
                while (fieldNames.hasNext()) {
                    String fieldName = fieldNames.next();
                    String value = jsonNode.get(fieldName).asText();
                    if (NumberUtil.isInteger(value)) {
                        sqlCreator.equalCondition(fieldName, Integer.parseInt(value));
                    } else {
                        sqlCreator.equalCondition(fieldName, value);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        String sql = sqlCreator.countData(tableName);
        Query query = getQuery(sqlCreator, sql);
        Integer count = Integer.parseInt(StringUtil.toString(query.list().get(0)));
        return count;
    }
    @Override
    public Object get(Class tClass, String tableName, Integer id, ErrorCode errorCode) {
        try {
            SqlCreator sqlCreator = new SqlCreator(tClass);
            sqlCreator.equalCondition("id", id);
            String sql = sqlCreator.selectData(tableName);
            Query query = getQuery(sqlCreator, sql);
            return query.uniqueResult();
        } catch (Exception e) {
            throw new ApiException(errorCode);
        }
    }
    @Override
    public Query getQuery(SqlCreator sqlCreator, String sql) {
        Query query = getCurrentSession().createSQLQuery(sql);
        for (String key : sqlCreator.getKeyValueMap().keySet()) {
            Object value = sqlCreator.getKeyValueMap().get(key);
            if (value instanceof Collection) {
                query.setParameterList(key, (Collection) value);
            } else {
                query.setParameter(key, value);
            }
        }
        query.setResultTransformer(sqlCreator.getTransformer());
        return query;
    }
    @Override
    public void insertBatch(final List<String> insertSqlList) {
        Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
        session.doWork(
                new Work() {
                    public void execute(Connection connection) throws SQLException {
                        if (!CollectionUtil.isEmpty(insertSqlList)) {
                            Statement stmt = connection.createStatement();
                            connection.setAutoCommit(false);
                            for (String sql : insertSqlList) {
                                stmt.addBatch(sql);
                            }
                            try {
                                stmt.executeBatch();
                            }  catch (Exception ex) {
                                LogService.getLogger().error("insertBatch-ERROR: ", ex);
                            }
                            stmt.close();
                        }
                    }
                }
        );
    }
    public Session openSession() {
        return getHibernateTemplate().getSessionFactory().openSession();
    }
    @Override
    public Session getCurrentSession() {
        return getHibernateTemplate().getSessionFactory().getCurrentSession();
    }
    @Override
    public Integer getMaxId(String tableName) {
        String sql = "select max(id) from " + tableName;
        Query query = getCurrentSession().createSQLQuery(sql);
        Object object = query.uniqueResult();
        Integer maxId = object == null ? 1 : Integer.parseInt(object.toString()) + 1;
        return maxId;
    }
    @Override
    public Query getExeuteQuery(SqlCreator sqlCreator, String sql) {
        Query query = getCurrentSession().createSQLQuery(sql);
        for (String key : sqlCreator.getKeyValueMap().keySet()) {
            Object value = sqlCreator.getKeyValueMap().get(key);
            if (value instanceof Collection) {
                query.setParameterList(key, (Collection) value);
            } else {
                query.setParameter(key, value);
            }
        }
        return query;
    }
    protected void doClose(Session session, Statement stmt, ResultSet rs) {
        if (rs != null) {
            try {
                rs.close();
                rs = null;
            } catch (Exception ex) {
                rs = null;
                LogService.getLogger().error("close-ResultSet ", ex);
                ex.printStackTrace();
            }
        }
        if (stmt != null) {
            try {
                stmt.close();
                stmt = null;
            } catch (Exception ex) {
                stmt = null;
                LogService.getLogger().error("close-ResultSet ", ex);
                ex.printStackTrace();
            }
        }
    }
}

+ 0 - 28
Hos-Framework/src/main/java/com/yihu/ehr/framework/common/dao/XSQLGeneralDAO.java

@ -1,10 +1,6 @@
package com.yihu.ehr.framework.common.dao;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.model.DataGridResult;
import com.yihu.ehr.framework.util.sql.SqlCreator;
import org.hibernate.Query;
import org.hibernate.Session;
import java.io.Serializable;
import java.util.List;
@ -116,28 +112,4 @@ public interface XSQLGeneralDAO {
     * @return
     */
    void execute(String sql) throws Exception;
    public <T> List getEntityList(Class<T> cls, String hql);
    public <T> List getEntityList(Class<T> cls, String query, String order, Integer limit, Integer offset, ErrorCode errorCode);
    public <T> List getEntityListByParentId(Class<T> cls, String patentFiledName, Integer parentId, String query, String order, Integer limit, Integer offset, ErrorCode errorCode);
    public <T> List getList(Class<T> cls, String tableName, String condition, String order, Integer limit, Integer offset, ErrorCode errorCode);
    public <T> Integer getDataSetInt(Class<T> cls, String tableName, String condition);
    public <T> Object get(Class<T> cls, String tableName, Integer id, ErrorCode errorCode);
    public Session getCurrentSession();
    public Session openSession();
    public Query getQuery(SqlCreator sqlCreator, String sql);
    public Query getExeuteQuery(SqlCreator sqlCreator, String sql);
    public Integer getMaxId(String tableName);
    public void insertBatch(final List<String> insertSqlList);
}

+ 0 - 81
Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/Constants.java

@ -1,81 +0,0 @@
package com.yihu.ehr.framework.constrant;
/**
 * Created by lingfeng on 2015/6/23.
 */
public class Constants {
    public static final String CREATE_TABLE = " CREATE TABLE ";
    public static final String INSERT_INTO = " INSERT INTO ";
    public static final String ALTER_TABLE = " ALTER TABLE ";
    public static final String DROP_TABLE = " DROP TABLE ";
    public static final String SELECT = " SELECT ";
    public static final String UPDATE = "UPDATE ";
    public static final String DELETE = "DELETE ";
    public static final String FROM = " FROM ";
    public static final String WHERE = " WHERE ";
    public static final String COUNT = " COUNT(*) ";
    public static final String ASTERISK = "*";
    public static final String IN = " IN ";
    public static final String BETWEEN = " BETWEEN ";
    public static final String BEGIN = "begin";
    public static final String END = "end";
    public static final String LIKE = " LIKE ";
    public static final String OR = " OR ";
    public static final String EQUAL_MARK = " = ";
    public static final String NE_MARK = " != ";
    public static final String GREATER_EQUAL_MARK = " >= ";
    public static final String LESS_EQUAL_MARK = " <= ";
    public static final String GREATER_MARK = " > ";
    public static final String LESS_MARK = " < ";
    public static final String SET = " SET ";
    public static final String AND = " AND ";
    public static final String QUESTION_MARK = " ? ";
    public static final String ADD = " ADD ";
    public static final String NOT_NULL = " NOT NULL ";
    public static final String BLANK = " ";
    public static final String PRIMARY_KEY = "PRIMARY_KEY ";
    public static final String PERCENT = "%";
    public static final String LEFT_BRACKET = "(";
    public static final String RIGHT_BRACKET = ")";
    public static final String COMMA = ",";
    public static final String SEMICOLON = ";";
    public static final String COLON = ":";
    public static final String UNION = " UNION ";
    public static final String VALUES = " VALUES ";
    public static final String ORDER_BY = " ORDER BY ";
    public static final String ASC = "ASC";
    public static final String DESC = "DESC";
    public static final String ROW_FORMAT_DYNAMIC = "row_format=dynamic";
    public static final String USERNAME_KEY = "u2akgXkkRRkiiCVR";
    public static final String ACCESS_TOKEN = "accessToken";
    public static final String REFRESH_TOKEN = "refreshToken";
    public static final String TOKEN_FAILD = "tokenFaild";
    public static final String TOKEN_EXPIRED = "tokenExpired";
    public static final String EMPTY = "";
    public static final String CDA_FILE = "CDA_File";
    public static final String STANDARD_ZIP = "standard.zip";
    public static final String DOT = ".";
    public static final String UPDATE_TYPE = "update";
    public static final String DELETE_TYPE = "delete";
    public static final String ADD_TYPE = "add";
    public static final String TABLE_KEY = "id";
    public static final String FAILURE_FLG = "valid";
    public static final String UNDERLINE = "_";
    public static final String STD_PREFIX = "std_";
    public static final String ADAPTER_PREFIX = "adapter_";
    public static final String ORIGIN_PREFIX = "origin_";
    public static final String CODE_STR = "code";
    public static final String VALUE_STR = "value";
    public static final String STANDARD = "standard";
    public static final String OK = "ok";
    public static final String NO = "no";
    public static final Integer NUMBER_ZREO = 0;
    public static final Integer NUMBER_ONE = 1;
    public static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
    public static final String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
    public static final String SQLSERVER_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    public static final String MYSQL = "mysql";
    public static final String ORACLE = "oracle";
    public static final String SQLSERVER = "sqlserver";
}

+ 27 - 128
Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/ErrorCode.java

@ -1,12 +1,14 @@
package com.yihu.ehr.framework.constrant;
/**
 *
 * @author Sand
 * @version 1.0
 * @created 2015.08.10 17:49
 */
public enum ErrorCode {
    // 通用错误 -- 接口调用错误列表
    MissMethod("ehr.common.miss.method"),
    MissTimestamp("ehr.common.miss.timestamp"),
    MissAppKey("ehr.common.miss.appid"),
@ -20,27 +22,33 @@ public enum ErrorCode {
    InvalidApiVersion("ehr.common.invalid.version"),
    InvalidSign("ehr.common.invalid.sign"),
    InvalidSignMethod("ehr.common.invalid.signMethod"),
    InvalidParameterFormat("ehr.common.invalid.parameterFormat"),
    MissRequiredArgument("ehr.common.miss.required.argument"),
    MissParameter("ehr.common.miss.parameter"),
    InvalidParameter("ehr.common.invalid.parameter"),
    AppTokenExpired("ehr.common.appToken.expired"),
    // 通用错误 -- 查询错误列表
    QueryNoData("ehr.common.query.null"),
    QueryTotalCount("ehr.common.query.count"),
    // 通用错误 -- 更新错误列表
    SuccessSave("ehr.common.success.update"),
    InvalidUpdate("ehr.common.invalid.update"),
    // 通用错误 -- 新增错误列表
    SuccessAdd("ehr.common.success.create"),
    // 通用错误 -- 删除错误列表
    SuccessDelete("ehr.common.success.delete"),
    InvalidDelete("ehr.common.invalid.delete"),
    // 通用错误 -- 提示信息列表
    InputRequestSingle("ehr.common.input.request.single"),
    InputRequestMultiple("ehr.common.input.request.multiple"),
    // 功能错误信息列表
    // 功能错误信息列表 - 登录
    InvalidUser("ehr.invalid.user"),
    GetUserSecurityFailed("ehr.get.user.security.failed"),
    InvalidUserNameOrPwd("ehr.invalid.username.or.pwd"),
@ -49,24 +57,32 @@ public enum ErrorCode {
    MailHasValidate("ehr.login.mail.hasinvaild"),
    InvalidMail("ehr.login.mail.invaild"),
    //功能错误信息列表 - 用户管理
    ExistUserForCreate("ehr.user.exist.create"),
    SuccessPublicKeyCreate("ehr.publicKey.success.create"),
    // 功能错误信息列表 - 机构管理
    ExistOrgForCreate("ehr.org.exist.create"),
    ExistOrgForStandard("ehr.org.exist.standard"),
    // 功能错误信息列表 - 应用管理
    InvalidAppRegister("ehr.app.register.invalid"),
    // 功能错误信息列表 - 病人管理
    MissIdentityNo("ehr.patient.miss.identity.no"),
    InvalidIdentityNo("ehr.patient.invalid.identity.no"),
    PatientRegisterFailed("ehr.patient.register.failed"),
    InvalidFormatPatientRegister("ehr.patient.invalid.register.info"),
    PatientRegisterFailedForExist("ehr.patient.exist.create"),
    // 功能错误信息列表 - 病人管理 - 档案
    MissArchiveFile("ehr.archive.miss.file"),
    MissArchiveCrypto("ehr.archive.miss.cryptograph"),
    ParseArchiveCryptoFailed("ehr.archive.parse.cryptograph.failed"),
    SaveArchiveFailed("ehr.archive.save.failed"),
    // 功能错误信息列表 - 病人管理 - 卡
    // 功能错误信息列表 - 字典
    RepeatSysDictName("ehr.sysDict.name.repeat"),
    RepeatOrgDict("ehr.orgDict.repeat"),
    RepeatOrgDictItem("ehr.orgDictItem.repeat"),
@ -82,6 +98,7 @@ public enum ErrorCode {
    InvalidDelSysDictEntry("ehr.sysDictEntry.del.invalid"),
    InvalidUpdateSysDictEntry("ehr.sysDictEntry.update.invalid"),
    // 功能错误信息列表 - 标准化
    ParamError("ehr.std.param.error"),
    InvalidStdVersion("ehr.std.invalid.version"),
    GenerateArchiveFailed("ehr.std.generate.schema.file.failed"),
@ -92,158 +109,37 @@ public enum ErrorCode {
    GetStdVersionFailed("ehr.std.get.version.fail"),
    UnknownStdVersion("ehr.std.version.unknown"),
    // 功能错误信息列表 - CDA
    GetCDAVersionListFailed("ehr.cda.version.list.get.failed"),
    GetCDAVersionFailed("ehr.cda.version.get.failed"),
    SaveCDAVersionFailed("ehr.cda.version.save.failed"),
    GetCDAInfoFailed("ehr.std.get.CDA.list.failed"),
    StdVersionHasPublished("ehr.cda.version.published"),
    GetSchemeVersionListFailed("ehr.scheme.version.list.get.failed"),
    GetSchemeVersionFailed("ehr.scheme.version.get.failed"),
    SaveSchemeVersionFailed("ehr.scheme.version.save.failed"),
    UpdateSchemeVersionFailed("ehr.scheme.version.update.failed"),
    DeleteSchemeVersionFailed("ehr.scheme.version.delete.failed"),
    ExistSchemeVersionName("ehr.scheme.version.name.exist"),
    GetSchemeListFailed("ehr.schemeList.Get.failed"),
    GetSchemeFailed("ehr.scheme.Get.failed"),
    SaveSchemeFailed("ehr.scheme.Save.failed"),
    UpdateSchemeFailed("ehr.scheme.update.failed"),
    DeleteSchemeFailed("ehr.scheme.delete.failed"),
    ExistSchemeVersion("ehr.scheme.version.exist"),
    ExistSchemeName("ehr.scheme.name.exist"),
    GetSchemeDispatchListFailed("ehr.schemeDispatchList.Get.failed"),
    GetSchemeDispatchFailed("ehr.schemeDispatch.Get.failed"),
    SaveSchemeDispatchFailed("ehr.schemeDispatch.Save.failed"),
    UpdateSchemeDispatchFailed("ehr.schemeDispatch.update.failed"),
    DeleteSchemeDispatchFailed("ehr.schemeDispatch.delete.failed"),
    StandardGetListFailed("ehr.standard.getlist.failed"),
    StandardSaveFailed("ehr.standard.save.failed"),
    StandardDeleteFailed("ehr.standard.delete.failed"),
    StandardDeletePublished("ehr.standard.delete.published"),
    StandardUpdateFailed("ehr.standard.update.failed"),
    StandardGetFailed("ehr.standard.get.failed"),
    StandardForkFailed("ehr.standard.fork.failed"),
    StandardImportFailed("ehr.standard.import.failed"),
    StandardExportFailed("ehr.standard.export.failed"),
    ExistStandardCode("ehr.standard.code.exist"),
    ExistStandardName("ehr.standard.name.exist"),
    ExistStandardVersion("ehr.standard.version.exist"),
    StandardVersionGetListFailed("ehr.standard.version.getlist.failed"),
    StandardVersionSaveFailed("ehr.standard.version.save.failed"),
    StandardVersionDeleteFailed("ehr.standard.version.delete.failed"),
    StandardVersionDeletePublished("ehr.standard.version.delete.published"),
    StandardVersionUpdateFailed("ehr.standard.version.update.failed"),
    StandardVersionGetFailed("ehr.standard.version.get.failed"),
    StandardVersionForkFailed("ehr.standard.version.fork.failed"),
    StandardVersionPublishFailed("ehr.standard.version.publish.failed"),
    ExistStandardVersionName("ehr.standard.version.name.exist"),
    StandardVersionUsedDeleteFailed("ehr.standard.version.used.delete.failed"),
    StandardCDACatalogGetListFailed("ehr.standard.cda.catalog.getlist.failed"),
    StandardCDACatalogSaveFailed("ehr.standard.cda.catalog.save.failed"),
    StandardCDACatalogDeleteFailed("ehr.standard.cda.catalog.delete.failed"),
    StandardCDACatalogUpdateFailed("ehr.standard.cda.catalog.update.failed"),
    StandardCDACatalogGetFailed("ehr.standard.cda.catalog.get.failed"),
    StandardCDADatasetMissVersion("ehr.standard.cda.dataset.miss.verison"),
    StandardCDADatasetMissID("ehr.standard.cda.dataset.miss.id"),
    StandardCDADatasetGetListFailed("ehr.standard.cda.dataset.getlist.failed"),
    StandardCDADatasetSaveFailed("ehr.standard.cda.dataset.save.failed"),
    StandardCDADatasetDeleteFailed("ehr.standard.cda.dataset.delete.failed"),
    StandardCDADatasetUpdateFailed("ehr.standard.cda.dataset.update.failed"),
    StandardCDADatasetGetFailed("ehr.standard.cda.dataset.get.failed"),
    StandardCDAMissVersion("ehr.standard.cda.miss.verison"),
    StandardCDAMissID("ehr.standard.cda.miss.id"),
    StandardCDAGetListFailed("ehr.standard.cda.getlist.failed"),
    StandardCDASaveFailed("ehr.standard.cda.save.failed"),
    StandardCDADeleteFailed("ehr.standard.cda.delete.failed"),
    StandardCDAUpdateFailed("ehr.standard.cda.update.failed"),
    StandardCDAGetFailed("ehr.standard.cda.get.failed"),
    StandardDatasetCatalogMissID("ehr.standard.dataset.catalog.miss.id"),
    StandardDatasetCatalogGetListFailed("ehr.standard.dataset.catalog.getlist.failed"),
    StandardDatasetCatalogSaveFailed("ehr.standard.dataset.catalog.save.failed"),
    StandardDatasetCatalogDeleteFailed("ehr.standard.dataset.catalog.delete.failed"),
    StandardDatasetCatalogUpdateFailed("ehr.standard.dataset.catalog.update.failed"),
    StandardDatasetCatalogGetFailed("ehr.standard.dataset.catalog.get.failed"),
    StandardDatasetMissVersion("ehr.standard.dataset.miss.version"),
    StandardDatasetMissID("ehr.standard.dataset.miss.id"),
    StandardDatasetGetListFailed("ehr.standard.dataset.getlist.failed"),
    StandardDatasetSaveFailed("ehr.standard.dataset.save.failed"),
    StandardDatasetDeleteFailed("ehr.standard.dataset.delete.failed"),
    StandardDatasetUpdateFailed("ehr.standard.dataset.update.failed"),
    StandardDatasetGetFailed("ehr.standard.dataset.get.failed"),
    ExistStandardDatasetCode("ehr.standard.dataset.code.exist"),
    StandardMetaDataMissVersion("ehr.standard.metadatamiss.version"),
    StandardMetaDataMissID("ehr.standard.metadatamiss.id"),
    StandardMetaDataGetListFailed("ehr.standard.metadatagetlist.failed"),
    StandardMetaDataSaveFailed("ehr.standard.metadatasave.failed"),
    StandardMetaDataDeleteFailed("ehr.standard.metadatadelete.failed"),
    StandardMetaDataUpdateFailed("ehr.standard.metadataupdate.failed"),
    StandardMetaDataGetFailed("ehr.standard.metadataget.failed"),
    ExistStandardMetaDataCode("ehr.standard.metaData.code.exist"),
    StandardDictMissVersion("ehr.standard.dict.miss.version"),
    StandardDictMissID("ehr.standard.dict.miss.id"),
    StandardDictGetListFailed("ehr.standard.dict.getlist.failed"),
    StandardDictSaveFailed("ehr.standard.dict.save.failed"),
    StandardDictDeleteFailed("ehr.standard.dict.delete.failed"),
    StandardDictUpdateFailed("ehr.standard.dict.update.failed"),
    StandardDictGetFailed("ehr.standard.dict.get.failed"),
    ExistStandardDictCode("ehr.standard.dict.code.exist"),
    StandardDictEntryMissVersion("ehr.standard.dict.entry.miss.version"),
    StandardDictEntryMissID("ehr.standard.dict.entry.miss.id"),
    StandardDictEntryGetListFailed("ehr.standard.dict.entry.getlist.failed"),
    StandardDictEntrySaveFailed("ehr.standard.dict.entry.save.failed"),
    StandardDictEntryDeleteFailed("ehr.standard.dict.entry.delete.failed"),
    StandardDictEntryUpdateFailed("ehr.standard.dict.entry.update.failed"),
    StandardDictEntryGetFailed("ehr.standard.dict.entry.get.failed"),
    ExistStandardDictEntryCode("ehr.standard.dict.entry.code.exist"),
    // 功能错误信息列表 - 数据集
    GetDataSetListFailed("ehr.datasetlist.Get.failed"),
    GetDataSetFailed("ehr.dataset.Get.failed"),
    SavedatasetFailed("ehr.dataset.Save.failed"),
    UpdateDatasetFailed("ehr.dataset.update.failed"),
    DeleteDataSetFailed("ehr.dataset.delete.failed"),
    GetDataSetRelationListFailed("ehr.datasetRelationlist.Get.failed"),
    GetDataSetRelationFailed("ehr.datasetRelation.Get.failed"),
    SaveDatasetRelationFailed("ehr.datasetRelation.Save.failed"),
    UpdateatasetRelationFailed("ehr.datasetRelation.update.failed"),
    DeleteDataSetRelationFailed("ehr.datasetRelation.delete.failed"),
    GetMetaDataListFaield("ehr.metadatalist.Get.failed"),
    GetMetaDataFailed("ehr.metadata.Get.failed"),
    SaveMetaDataFailed("ehr.metadata.save.failed"),
    UpdateMetaDataFailed("ehr.metadata.update.failed"),
    DeleteMetaDataFailed("ehr.metadata.delete.failed"),
    // 功能错误信息列表 - 标准字典
    GetDictListFaild("ehr.dictlist.Get.failed"),
    GetDictFaild("ehr.dict.Get.failed"),
    GetDictEntryListFailed("ehr.dict.entries.get.failed"),
    GetDictEntryFailed("ehr.dict.entry.get.failed"),
    SaveDictFailed("ehr.dict.Save.failed"),
    UpdateDictFailed("ehr.dict.update.failed"),
    DeleteDictFailed("ehr.dict.delete.failed"),
    saveDictEntryFailed("ehr.dict.entry.save.failed"),
    UpdateDictEntryFailed("ehr.dict.entry.update.failed"),
    DeleteDictEntryFailed("ehr.dict.entry.delete.failed"),
    GetPublisherListFaield("ehr.publisherList.get.failed"),
    GetPublisherFailed("ehr.publisher.get.failed"),
    SavePublisherFailed("ehr.publisher.save.failed"),
    UpdatePublisherFailed("ehr.publisher.update.failed"),
    DeletePublisherFailed("ehr.publisher.delete.failed"),
    // 功能错误信息列表 - 标准数据来源
    GetStandardSourceFailed("ehr.std.get.source.list.failed"),
    // 接口模块连接错误信息列表 - 授权Token
    GenerateUserKeyFailed("ehr.security.generate.user.key.failed"),
    GetUserKeyFailed("ehr.security.get.user.key.failed"),
    UserAccessTokenExpired("ehr.security.token.expired"),
@ -254,13 +150,16 @@ public enum ErrorCode {
    NameIsNull("ehr.system.name.null"),
    VersionCodeIsNull("ehr.system.versioncode.null"),
    // 数据库连接错误信息列表 - 事件
    GetEhrArchiveFailed("ehr.ehr.get.archive"),
    GetEhrDataSetFailed("ehr.ehr.get.data.set"),
    // 数据库连接错误信息列表 - hbase
    CreateEhrDataSetTableFailed("ehr.ehr.create.data.set.table.failed"),
    TruncateTableFailed("ehr.hbase.truncate.table.failed"),
    GetTableFailed("ehr.hbase.get.table.failed"),
    // 数据库连接错误信息列表 - solr
    ClearSolrDataFailed("ehr.clear.solr.data.failed"),
    //

+ 5 - 5
Hos-Framework/src/main/java/com/yihu/ehr/framework/constrant/TreeView.java

@ -10,7 +10,7 @@ public class TreeView {
    private String id;
    private String pid;
    private String text;
    private Boolean ischecked;
    private Boolean isChecked;
    public String getId() {
        return id;
@ -36,11 +36,11 @@ public class TreeView {
        this.text = text;
    }
    public Boolean getIschecked() {
        return ischecked;
    public Boolean getIsChecked() {
        return isChecked;
    }
    public void setIschecked(Boolean ischecked) {
        this.ischecked = ischecked;
    public void setIsChecked(Boolean isChecked) {
        this.isChecked = isChecked;
    }
}

+ 0 - 41
Hos-Framework/src/main/java/com/yihu/ehr/framework/exception/ApiException.java

@ -1,41 +0,0 @@
package com.yihu.ehr.framework.exception;
import com.yihu.ehr.framework.constrant.ErrorCode;
/**
 * @author Sand
 * @version 1.0
 * @created 2015.12.20 16:05
 */
public class ApiException extends RuntimeException {
    private static final long serialVersionUID = 1464313464798414L;
    private ErrorCode errCode;
    private String errMsg;
    public ErrorCode getErrorCode() {
        return errCode;
    }
    public void setErrCode(ErrorCode errCode) {
        this.errCode = errCode;
    }
    public String getErrMsg() {
        return errMsg;
    }
    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }
    public ApiException(ErrorCode errCode) {
        this.errCode = errCode;
    }
    public ApiException(ErrorCode errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }
}

+ 0 - 218
Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/BeanTransformer.java

@ -1,218 +0,0 @@
package com.yihu.ehr.framework.util.sql;
import org.hibernate.transform.ResultTransformer;
import javax.persistence.Column;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @created Airhead 2015/12/26.
 */
public class BeanTransformer<T> implements ResultTransformer {
    private final Class<T> mapClass;
    public Map<String, String> columnToProperty;
    public Map<String, String> propertyToColumn;
    public BeanTransformer(Class<T> mapClass) {
        this.mapClass = mapClass;
        this.initColumnsToProperties();
        this.initPropertiesToColumns();
    }
    public Object transformTuple(Object[] tuple, String[] aliases) {
        try {
            PropertyDescriptor[] props = this.propertyDescriptors();
            int[] col2Pro = this.mapColumnsToProperties(aliases, props);
            return this.createBean(tuple, mapClass, props, col2Pro);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public List transformList(List list) {
        return list;
    }
    protected T newInstance(Class<T> c) throws Exception {
        try {
            return c.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new Exception("Cannot create " + c.getName() + ": " + e.getMessage());
        }
    }
    protected int[] mapColumnsToProperties(String[] aliases, PropertyDescriptor[] props) throws SQLException {
        int[] col2Pro = new int[aliases.length];
        Arrays.fill(col2Pro, -1);
        for (int col = 0; col < aliases.length; ++col) {
            String columnName = aliases[col];
            String propertyName = this.columnToProperty.get(columnName.toUpperCase());
            for (int i = 0; i < props.length; ++i) {
                if (propertyName.equals(props[i].getName())) {
                    col2Pro[col] = i;
                    break;
                }
            }
        }
        return col2Pro;
    }
    private T createBean(Object[] tuple, Class<T> type, PropertyDescriptor[] props, int[] col2Pro) throws Exception {
        T bean = this.newInstance(type);
        for (int i = 0; i < col2Pro.length; ++i) {
            int realIndex = col2Pro[i];
            if (realIndex != -1) {
                Object value = tuple[i];
                PropertyDescriptor prop = props[realIndex];
                this.callSetter(bean, prop, value);
            }
        }
        return bean;
    }
    private void callSetter(Object target, PropertyDescriptor prop, Object value) throws Exception {
        Method setter = prop.getWriteMethod();
        if (setter == null) {
            return;
        }
        Class<?>[] params = setter.getParameterTypes();
        try {
            // convert types for some popular ones
            if (value instanceof java.util.Date) {
                final String targetType = params[0].getName();
                if ("java.sql.Date".equals(targetType)) {
                    value = new java.sql.Date(((java.util.Date) value).getTime());
                } else if ("java.sql.Time".equals(targetType)) {
                    value = new java.sql.Time(((java.util.Date) value).getTime());
                } else if ("java.sql.Timestamp".equals(targetType)) {
                    Timestamp tsValue = (Timestamp) value;
                    int nanos = tsValue.getNanos();
                    value = new Timestamp(tsValue.getTime());
                    ((Timestamp) value).setNanos(nanos);
                }
            } else {
//                if (value instanceof String && params[0].isEnum()) {
//                    value = Enum.valueOf(params[0].asSubclass(Enum.class), (String) value);
//                }
            }
            // Don't call setter if the value object isn't the right type
            if (this.isCompatibleType(value, params[0])) {
                setter.invoke(target, new Object[]{value});
            } else {
                throw new Exception(
                        "Cannot set " + prop.getName() + ": incompatible types, cannot convert "
                                + value.getClass().getName() + " to " + params[0].getName());
                // value cannot be null here because isCompatibleType allows null
            }
        } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
            throw new SQLException(
                    "Cannot set " + prop.getName() + ": " + e.getMessage());
        }
    }
    private void initColumnsToProperties() {
        columnToProperty = new HashMap<>();
        Field[] fields = mapClass.getDeclaredFields();
        for (Field f : fields) {
            Column column = f.getAnnotation(Column.class);
            if (column == null) {
                continue;
            }
            String columnName = column.name();
            String propertyName = f.getName();
            columnToProperty.put(columnName.toUpperCase(), propertyName);
        }
    }
    private void initPropertiesToColumns() {
        propertyToColumn = new HashMap<>();
        Field[] fields = mapClass.getDeclaredFields();
        for (Field f : fields) {
            Column column = f.getAnnotation(Column.class);
            if (column == null) {
                continue;
            }
            String columnName = column.name();
            String propertyName = f.getName();
            propertyToColumn.put(propertyName,columnName.toUpperCase());
        }
    }
    private PropertyDescriptor[] propertyDescriptors() throws Exception {
        BeanInfo beanInfo = null;
        try {
            beanInfo = Introspector.getBeanInfo(mapClass);
        } catch (IntrospectionException e) {
            throw new Exception("Bean introspection failed: " + e.getMessage());
        }
        return beanInfo.getPropertyDescriptors();
    }
    private boolean isCompatibleType(Object value, Class<?> type) {
        // Do object check first, then primitives
        if (value == null || type.isInstance(value)) {
            return true;
        } else if (type.equals(Integer.TYPE) && value instanceof Integer) {
            return true;
        } else if (type.equals(Integer.TYPE) && value instanceof Long) {
            return true;
        } else if (type.equals(Long.TYPE) && value instanceof Long) {
            return true;
        } else if (type.equals(Double.TYPE) && value instanceof Double) {
            return true;
        } else if (type.equals(Float.TYPE) && value instanceof Float) {
            return true;
        } else if (type.equals(Short.TYPE) && value instanceof Short) {
            return true;
        } else if (type.equals(Byte.TYPE) && value instanceof Byte) {
            return true;
        } else if (type.equals(Character.TYPE) && value instanceof Character) {
            return true;
        } else if (type.equals(Boolean.TYPE) && value instanceof Boolean) {
            return true;
        }
        return false;
    }
}

+ 0 - 106
Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/RequestParamTransformer.java

@ -1,106 +0,0 @@
package com.yihu.ehr.framework.util.sql;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.exception.ApiException;
import com.yihu.ehr.framework.util.operator.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.io.IOException;
import java.util.*;
/**
 * @created Airhead 2015/12/29.
 */
public class RequestParamTransformer {
    public static final String SEPARATOR_FIELD = ",";
    public static final String SEPARATOR_KEYVALUE = ":";
    public static Map<String, Object> parseQuery(String query) throws ApiException {
        HashMap<String, Object> queryMap = new HashMap<String, Object>();
        if (StringUtils.isEmpty(query)) {
            return queryMap;
        }
        for (String cond : StringUtils.split(query, SEPARATOR_FIELD)) {
            String[] kv = StringUtils.split(cond, SEPARATOR_KEYVALUE);
            if (kv.length != 2) {
                throw new ApiException(ErrorCode.InvalidParameterFormat);
            }
            String key = kv[0];
            String value = kv[1];
            queryMap.put(key, value);
        }
        return queryMap;
    }
    public static List<String> parseField(String fields) {
        List<String> fieldList = new ArrayList<String>();
        if (StringUtils.isEmpty(fields)) {
            return fieldList;
        }
        String[] filters = StringUtils.split(fields, SEPARATOR_FIELD);
        return Arrays.asList(filters);
    }
    public static List<String> parseSortBy(String sortBy) {
        List<String> sortList = new ArrayList<String>();
        if (StringUtils.isEmpty(sortBy)) {
            return sortList;
        }
        String[] fields = StringUtils.split(sortBy, SEPARATOR_FIELD);
        return Arrays.asList(fields);
    }
    public static List<String> parseOrder(String order) {
        List<String> orderList = new ArrayList<String>();
        if (StringUtils.isEmpty(order)) {
            return orderList;
        }
        String[] fields = StringUtils.split(order, SEPARATOR_FIELD);
        return Arrays.asList(fields);
    }
    public static Long parseLimit(String limit) {
        if (StringUtils.isEmpty(limit)) {
            return -1L;
        }
        return NumberUtils.toLong(limit);
    }
    public static Long parseOffset(String offset) {
        if (StringUtils.isEmpty(offset)) {
            return 0L;
        }
        return NumberUtils.toLong(offset);
    }
    public static Map parseJsonToMap(String condition) {
        ObjectMapper objectMapper = new ObjectMapper();
        HashMap<String, String> map = new HashMap<String, String>();
        if (!StringUtil.isEmpty(condition)) {
            try {
                JsonNode jsonNode = objectMapper.readTree(condition);
                Iterator<String> fileNames = jsonNode.fieldNames();
                while (fileNames.hasNext()) {
                    String fieldName = fileNames.next();
                    String value = jsonNode.get(fieldName).asText();
                    map.put(fieldName, value);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return map;
    }
}

+ 0 - 317
Hos-Framework/src/main/java/com/yihu/ehr/framework/util/sql/SqlCreator.java

@ -1,317 +0,0 @@
package com.yihu.ehr.framework.util.sql;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.yihu.ehr.framework.constrant.Constants;
import com.yihu.ehr.framework.util.operator.CollectionUtil;
import com.yihu.ehr.framework.util.operator.StringUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by lingfeng on 2015/6/23.
 */
public class SqlCreator {
    private String tableName;
    private List<String> itemList;
    private List<String> itemValueList;
    private List<String> conditionList;
    private List<String> orderList;
    private Map<String, Object> keyValueMap;
    private BeanTransformer transformer;
    public SqlCreator(Class tClass) {
        keyValueMap = new HashMap<>();
        conditionList = new ArrayList<>();
        itemList = new ArrayList<>();
        itemValueList = new ArrayList<>();
        orderList = new ArrayList<>();
        transformer = new BeanTransformer(tClass);
    }
    public String insertData() {
        StringBuilder sqlBuffer = new StringBuilder();
        sqlBuffer.append(Constants.INSERT_INTO + tableName + Constants.LEFT_BRACKET);
        for (String item : itemList) {
            sqlBuffer.append(item + Constants.COMMA);
        }
        sqlBuffer.deleteCharAt(sqlBuffer.length() - 1);
        sqlBuffer.append(Constants.RIGHT_BRACKET + Constants.VALUES + Constants.LEFT_BRACKET);
        for (String item : itemValueList) {
            sqlBuffer.append(item + Constants.COMMA);
        }
        sqlBuffer.deleteCharAt(sqlBuffer.length() - 1);
        sqlBuffer.append(Constants.RIGHT_BRACKET + Constants.SEMICOLON);
        return sqlBuffer.toString();
    }
    public String insertData(String tabelName, JsonNode jsonNode) {
        setTableName(tabelName);
        for (Object key : transformer.columnToProperty.keySet()) {
            String property = StringUtil.toString(transformer.columnToProperty.get(key));
            JsonNode propertyJsonNode = jsonNode.get(property);
            if (propertyJsonNode != null) {
                itemList.add(StringUtil.toString(key));
                itemValueList.add(Constants.COLON + property);
                setKeyValueMapByType(property, propertyJsonNode, keyValueMap);
            }
        }
        return insertData();
    }
    public void setKeyValueMapByType(String property, JsonNode propertyJsonNode, Map<String, Object> keyValueMap) {
        JsonNodeType jsonNodeType = propertyJsonNode.getNodeType();
        if (jsonNodeType.equals(JsonNodeType.STRING)) {
            keyValueMap.put(property, propertyJsonNode.asText());
        } else if (jsonNodeType.equals(JsonNodeType.NUMBER)) {
            keyValueMap.put(property, propertyJsonNode.asInt());
        } else {
            keyValueMap.put(property, null);
        }
    }
    public String countData(String tabelName) {
        StringBuilder sqlBuffer = new StringBuilder();
        setTableName(tabelName);
        sqlBuffer.append(Constants.SELECT);
        sqlBuffer.append(Constants.COUNT);
        sqlBuffer.append(Constants.FROM + tableName);
        if (!CollectionUtil.isEmpty(conditionList)) {
            sqlBuffer.append(Constants.WHERE);
            sqlBuffer.append("1=1" + Constants.AND);
            for (String condition : conditionList) {
                sqlBuffer.append(condition + Constants.AND);
            }
            sqlBuffer.delete(sqlBuffer.length() - 4, sqlBuffer.length() - 1);
        }
        return sqlBuffer.toString();
    }
    public String selectData(String tabelName) {
        setTableName(tabelName);
        for(Object key : transformer.columnToProperty.keySet()){
            itemList.add(StringUtil.toString(key));
        }
        return selectData();
    }
    public String selectData() {
        StringBuilder sqlBuffer = new StringBuilder();
        sqlBuffer.append(Constants.SELECT);
        for (String item : itemList) {
            sqlBuffer.append(item + Constants.COMMA);
        }
        sqlBuffer.deleteCharAt(sqlBuffer.length() - 1);
        sqlBuffer.append(Constants.FROM + tableName);
        if (!CollectionUtil.isEmpty(conditionList)) {
            sqlBuffer.append(Constants.WHERE);
            sqlBuffer.append("1=1" + Constants.AND);
            for (String condition : conditionList) {
                sqlBuffer.append(condition + Constants.AND);
            }
            sqlBuffer.delete(sqlBuffer.length() - 4, sqlBuffer.length() - 1);
        }
        if (!CollectionUtil.isEmpty(orderList)) {
            for (String order : orderList) {
                sqlBuffer.append(order);
            }
            sqlBuffer.delete(sqlBuffer.length() - 1, sqlBuffer.length());
        }
        return sqlBuffer.toString();
    }
    public String updateDataByTableKey(String tabelName, JsonNode jsonNode) {
        setTableName(tabelName);
        StringBuilder sqlBuffer = new StringBuilder();
        sqlBuffer.append(Constants.UPDATE + tableName + Constants.SET);
        Map columnToProperty = transformer.columnToProperty;
        for (Object key : columnToProperty.keySet()) {
            String property = StringUtil.toString(columnToProperty.get(key));
            if (!property.equals(Constants.TABLE_KEY)) {
                sqlBuffer.append(key + Constants.EQUAL_MARK + Constants.COLON + property + Constants.COMMA);
                setKeyValueMapByType(property, jsonNode.get(property), keyValueMap);
            }
        }
        sqlBuffer.deleteCharAt(sqlBuffer.length() - 1);
        Object tableKey = columnToProperty.get(Constants.TABLE_KEY.toUpperCase());
        sqlBuffer.append(Constants.WHERE + Constants.TABLE_KEY + Constants.EQUAL_MARK + Constants.COLON + tableKey);
        String property = StringUtil.toString(tableKey);
        setKeyValueMapByType(property, jsonNode.get(property), keyValueMap);
        return sqlBuffer.toString();
    }
    public String betweenCondition(String item, Object value1, Object value2) {
        String condition = item + Constants.BETWEEN + Constants.BEGIN + item + Constants.AND + Constants.END + item;
        keyValueMap.put(Constants.BEGIN + item, value1);
        keyValueMap.put(Constants.END + item, value2);
        conditionList.add(condition);
        return condition;
    }
    public String greaterAndEqualCondition(String item, Object value) {
        String condition = item + Constants.GREATER_EQUAL_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String greaterCondition(String item, Object value) {
        String condition = item + Constants.GREATER_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String lessAndEqualCondition(String item, Object value) {
        String condition = item + Constants.LESS_EQUAL_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String lessCondition(String item, Object value) {
        String condition = item + Constants.LESS_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String equalCondition(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String condition = column + Constants.EQUAL_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String inCondition(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String condition = column + Constants.IN + Constants.LEFT_BRACKET + Constants.COLON + item + Constants.RIGHT_BRACKET;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String equalConditionQue(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String condition = column + Constants.EQUAL_MARK + Constants.QUESTION_MARK;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String likeOrCondition(String item1, String item2, Object value) {
        if (!StringUtil.isEmpty(value)) {
            String column1 = StringUtil.toString(transformer.propertyToColumn.get(item1));
            String column2 = StringUtil.toString(transformer.propertyToColumn.get(item2));
            String condition = Constants.LEFT_BRACKET + column1 + Constants.LIKE + Constants.COLON + item1
                    + Constants.OR + column2 + Constants.LIKE + Constants.COLON + item2 + Constants.RIGHT_BRACKET;
            value = Constants.PERCENT + value + Constants.PERCENT;
            keyValueMap.put(item1, value);
            keyValueMap.put(item2, value);
            conditionList.add(condition);
            return condition;
        } else {
            return Constants.EMPTY;
        }
    }
    public String likeCondition(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String condition = column + Constants.LIKE + Constants.COLON + item;
        value = Constants.PERCENT + value + Constants.PERCENT;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String neCondition(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String condition = column + Constants.NE_MARK + Constants.COLON + item;
        keyValueMap.put(item, value);
        conditionList.add(condition);
        return condition;
    }
    public String order(String item, Object value) {
        String column = StringUtil.toString(transformer.propertyToColumn.get(item));
        String order;
        if (CollectionUtil.isEmpty(orderList)) {
            order = Constants.ORDER_BY + column + Constants.BLANK + value + Constants.COMMA;
        } else {
            order = column + Constants.BLANK + value + Constants.COMMA;
        }
        orderList.add(order);
        return order;
    }
    public String getTableName() {
        return tableName;
    }
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    public List<String> getItemList() {
        return itemList;
    }
    public void setItemList(List<String> itemList) {
        this.itemList = itemList;
    }
    public List<String> getItemValueList() {
        return itemValueList;
    }
    public void setItemValueList(List<String> itemValueList) {
        this.itemValueList = itemValueList;
    }
    public List<String> getConditionList() {
        return conditionList;
    }
    public void setConditionList(List<String> conditionList) {
        this.conditionList = conditionList;
    }
    public Map<String, Object> getKeyValueMap() {
        return keyValueMap;
    }
    public void setKeyValueMap(Map<String, Object> keyValueMap) {
        this.keyValueMap = keyValueMap;
    }
    public List<String> getOrderList() {
        return orderList;
    }
    public void setOrderList(List<String> orderList) {
        this.orderList = orderList;
    }
    public BeanTransformer getTransformer() {
        return transformer;
    }
    public void setTransformer(BeanTransformer transformer) {
        this.transformer = transformer;
    }
}

+ 5 - 7
Hos-Resource-Mini-Update/src/main/java/com/yihu/ehr/thread/UpdateThread.java

@ -201,9 +201,9 @@ public class UpdateThread implements Runnable {
        try {
            String system = System.getProperty("os.name").toLowerCase();
            if (system.contains("windows")) {
                String batPathStart = UpdateThread.class.getResource("/").getPath() + "config/start.bat";
                LogUtil.info("启动windows服务:" + batPathStart);
                LogUtil.info("启动windows服务");
                //windows
                String batPathStart = UpdateThread.class.getResource("/").getPath() + "config/start.bat";
                Process psStart = Runtime.getRuntime().exec(batPathStart);
                ByteArrayOutputStream baosStart = new ByteArrayOutputStream();
                InputStream osStart = psStart.getInputStream();
@ -213,9 +213,8 @@ public class UpdateThread implements Runnable {
                }
                osStart.close();
                baosStart.close();
                int i = 0;
                LogUtil.info("开始判断服务是否启动");
                while (true) {
                    int i = 0;
                    String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
                    Process ps = Runtime.getRuntime().exec(batPath);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
@ -226,13 +225,13 @@ public class UpdateThread implements Runnable {
                    String s = baos.toString();
                    os.close();
                    baos.close();
                    LogUtil.info("服务正在启动:" + Boolean.valueOf(s.trim()));
                    if (Boolean.valueOf(s.trim())) {
                        i++;
                        if (i > 3) {
                            LogUtil.info("服务启动成功");
                            break;
                        }
                        LogUtil.info("第" + i + "次判断服务已经启动");
                        Thread.sleep(1000L);
                    }
                }
            } else {
@ -374,7 +373,6 @@ public class UpdateThread implements Runnable {
    public static void main(String[] args) throws Exception {
        while (true) {
            String batPath = UpdateThread.class.getResource("/").getPath() + "config/serviceAlive.bat";
            System.out.println(batPath);
            Process ps = Runtime.getRuntime().exec(batPath);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            InputStream os = ps.getInputStream();

+ 1 - 1
Hos-Resource-Mini-Update/src/main/resources/config/serviceAlive.bat

@ -1,5 +1,5 @@
@echo off
for /f "skip=3 tokens=4" %%i in ('sc query tomcat8-esb-ds ') do set "zt=%%i" &goto :next
for /f "skip=3 tokens=4" %%i in ('sc query tomcat8-esb-ds') do set "zt=%%i" &goto :next
:next
if /i "%zt%"=="RUNNING" (
    echo true

+ 3 - 5
Hos-Resource-Mini-Update/target/classes/config/threadConfig.properties

@ -1,6 +1,6 @@
soft.versionCode=1
## service address
service.url=https://172.19.103.73:443/api/v1.0/
service.url=https://ehr.yihu.com/api/v1.0/
service.clientId = kHAbVppx44
service.clientKey = Bd2h8rdYhep6NKOO
service.username=user
@ -15,7 +15,7 @@ updateThread.downUpdateWar=simplified-esb/downUpdateWar
updateThread.uploadResult=simplified-esb/uploadResult
##service name
tomcat.servicename=tomcat8-esb-ds
tomcat.servicename=tomcat8-esb-service
##token
token.info={"fingerprint": "abc"}
@ -24,6 +24,4 @@ token.getToken=authorizations/clients/
token.user_name=kHAbVppx44
system.code=MINIESB
system.downloadPath=http://172.19.103.54/
system.code=MINIESB

+ 6 - 8
Hos-Resource-Mini-helper/src/main/java/com.yihu.ehr/thread/LogThread.java

@ -43,7 +43,7 @@ public class LogThread implements Runnable {
                            //发送日志文件
                            sendLogFile(file);
                            //删除日志文件
                            deleteLogFile(file);
                            //deleteLogFile(file);
                        }
                    }
                }
@ -96,7 +96,7 @@ public class LogThread implements Runnable {
            formParams.add(new BasicNameValuePair("access_token", token));
            formParams.add(new BasicNameValuePair("orgCode", orgCode));
            String booleanString = HttpsClientUtil.postFile(ThreadConfig.SERVICE_URL + ThreadConfig.LOG_THREAD_UPLOAD, file, formParams, ThreadConfig.SERVICE_USERNAME, ThreadConfig.SERVICE_PASSWORD);
            LogUtil.info("日志上传结果:" + booleanString);
            LogUtil.info("日志发送成功:" + booleanString);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
@ -105,8 +105,7 @@ public class LogThread implements Runnable {
        }
    }
    private void deleteLogFile(String filePathTemp) {
        File file=new File(filePathTemp);
    private void deleteLogFile(File file) {
        String filePath = file.getAbsolutePath();
        if (file.delete()) {
            LogUtil.info("日志删除成功");
@ -118,11 +117,10 @@ public class LogThread implements Runnable {
    public String getLogFile() {
        String home = System.getProperty("catalina.home").replace('\\', '/');
        String srcPath = home.substring(0, home.lastIndexOf('/') + 1) + "log4j";
        LogUtil.info("压缩日志,日志目录:" + srcPath);
        String srcPath = home.substring(0, home.lastIndexOf('/') + 1) +  "log4j";
        String filePath = srcPath + File.separator + logFileName;
        ZipUtil.zip(srcPath, filePath);
        LogUtil.info("上传的日志文件路径:" + filePath);
        LogUtil.info("日志文件路径:" + filePath);
        File file = new File(filePath);
        if (file.exists()) {
            LogUtil.info("-----------得到日志成功------------");
@ -135,7 +133,7 @@ public class LogThread implements Runnable {
    private void sleep() throws Exception {
        LogUtil.info("日志线程开始睡眠,睡眠时间(分钟):" + ThreadConfig.LOG_THREAD_SLEEP_TIME);
        Thread.sleep(sleepTime * ThreadConfig.LOG_THREAD_SLEEP_TIME);
        Thread.sleep(sleepTime * ThreadConfig.SQL_THREAD_SLEEP_TIME);
    }
    public static void main(String[] args) {

+ 0 - 12
Hos-Resource-Mini-helper/src/main/java/com.yihu.ehr/thread/SQLThread.java

@ -222,19 +222,7 @@ public class SQLThread implements Runnable {
                    JSONObject jo = JSONObject.fromObject(fillMiningResponString);
                    String id = (String) jo.get("id");
                    String startTime = (String) jo.get("startTime");
                    if (StringUtils.isEmpty(startTime) || startTime.equals("null")) {
                        LogUtil.info("-----------开始时间格式有错");
                        return;
                    }
                    String endtime = (String) jo.get("endTime");
                    if (StringUtils.isEmpty(endtime) || endtime.equals("null")) {
                        LogUtil.info("-----------结束时间格式有错");
                        return;
                    }
                    if (StringUtils.isEmpty(id) || id.equals("null")) {
                        LogUtil.info("-----------id格式有错");
                        return;
                    }
                    String sql = "insert into crawler_supply (id,start_time,end_time,status,remote_id) values " +
                            "('" + UUID.randomUUID() + "'," +
                            "'" + startTime + "' ," +

+ 3 - 3
Hos-Resource-Mini-helper/src/main/resources/config/threadConfig.properties

@ -1,15 +1,15 @@
soft.versionCode=1
## service address
service.url=https://192.168.131.15:443/api/v1.0/
service.url=https://172.19.103.73:443:443/api/v1.0/
service.clientId = kHAbVppx44
service.clientKey = Bd2h8rdYhep6NKOO
logThread.sleepTime=1
logThread.sleepTime=30
sqlThread.sleepTime=30
## logThread sleep time  min
logThread.uploadLog=esb/uploadLog
logThread.uploadLog=simplified-esb/uploadLog
logThread.getUploadFlag=simplified-esb/getUploadFlag

+ 1 - 6
Hos-Resource-Mini/pom.xml

@ -37,7 +37,7 @@
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.38</version>
            <version>5.1.37</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
@ -60,11 +60,6 @@
            <artifactId>json</artifactId>
            <version>20151123</version>
        </dependency>
        <dependency>
            <groupId>xom</groupId>
            <artifactId>xom</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>

+ 34 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/ApplicationStart.java

@ -29,14 +29,16 @@ public class ApplicationStart implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent context) {
        try {
            String home = System.getProperty("catalina.home").replace('\\','/');
            String homeUrl = home.substring(0,home.lastIndexOf('/')+1);
            dbConfig(homeUrl);
            sslConfig(homeUrl);
            crawlerConfig(homeUrl);
            startThread();
        } catch (Exception e) {
            System.out.print(e.getStackTrace().toString());
            LogUtil.error(e.getStackTrace().toString());
        }
    }
@ -74,6 +76,37 @@ public class ApplicationStart implements ServletContextListener {
        fos.close();
    }
    /**
     * 采集配置
     * @param homeUrl
     * @throws Exception
     */
    private void crawlerConfig(String homeUrl) throws Exception {
        System.setProperty(log4jDirKey, homeUrl + "log4j");
        SysConfig.getInstance().setTempFile(homeUrl + "standard");
        SysConfig.getInstance().setTrustStorePath(homeUrl + "ssl/tomcat.keystore");
        DBHelper db = new DBHelper();
        Object obj = db.scalar("select param_value from system_param where param_key='ORG_CODE'");
        if(obj!=null) {
            SysConfig.getInstance().setOrgCode(obj.toString());
        }
    }
    private void startThread() {
        Thread crawlerThread = new Thread(new CrawlerThread());
        Thread crawlerSupplyThread = new Thread(new CrawlerSupplyThread());
        Thread standardUpdateThread = new Thread(new StandardUpdateThread());
        ThreadManage.add(ThreadManage.CRAWLER_THREAD, crawlerThread);
        ThreadManage.add(ThreadManage.CRAWLER_SUPPLY_THREAD, crawlerSupplyThread);
        ThreadManage.add(ThreadManage.STANDARD_UPDATE_THREAD, standardUpdateThread);
        ThreadManage.setCrawlerInterval();
        ThreadManage.setUpdateInterval();
        //启动线程
        crawlerThread.start();
        crawlerSupplyThread.start();
        standardUpdateThread.start();
    }
    @Override
    public void contextDestroyed(ServletContextEvent context) {

+ 0 - 87
Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/ThreadStart.java

@ -1,87 +0,0 @@
package com.yihu.ehr.common;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.service.thread.CrawlerSupplyThread;
import com.yihu.ehr.service.thread.CrawlerThread;
import com.yihu.ehr.service.thread.StandardUpdateThread;
import com.yihu.ehr.service.thread.ThreadManage;
import com.yihu.ehr.util.log.LogUtil;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
/**
 * 线程启动执行
 * add by hzp at 2016-03-17
 */
public class ThreadStart implements ServletContextListener {
    private static Properties prop = new Properties();
    private String log4jDirKey = "log4j";
    @Override
    public void contextInitialized(ServletContextEvent context) {
        try {
            String home = System.getProperty("catalina.home").replace('\\','/');
            String homeUrl = home.substring(0,home.lastIndexOf('/')+1);
            crawlerConfig(homeUrl);
            startThread();
        } catch (Exception e) {
            System.out.print(e.getStackTrace().toString());
        }
    }
    @Override
    public void contextDestroyed(ServletContextEvent context) {
    }
    /**
     * 采集配置
     * @param homeUrl
     * @throws Exception
     */
    private void crawlerConfig(String homeUrl) throws Exception {
        System.setProperty(log4jDirKey, homeUrl + "log4j");
        SysConfig.getInstance().setTempFile(homeUrl + "standard");
    }
    /**
     * 启动线程
     */
    private void startThread() {
        try {
            DBHelper db = new DBHelper();
            Object obj = db.scalar("select param_value from system_param where param_key='ORG_CODE'");
            if (obj != null) {
                SysConfig.getInstance().setOrgCode(obj.toString());
            }
            Thread crawlerThread = new Thread(new CrawlerThread());
            Thread crawlerSupplyThread = new Thread(new CrawlerSupplyThread());
            Thread standardUpdateThread = new Thread(new StandardUpdateThread());
            ThreadManage.add(ThreadManage.CRAWLER_THREAD, crawlerThread);
            ThreadManage.add(ThreadManage.CRAWLER_SUPPLY_THREAD, crawlerSupplyThread);
            ThreadManage.add(ThreadManage.STANDARD_UPDATE_THREAD, standardUpdateThread);
            ThreadManage.setCrawlerInterval();
            ThreadManage.setUpdateInterval();
            //启动线程
            crawlerThread.start();
            crawlerSupplyThread.start();
            standardUpdateThread.start();
        }
        catch (Exception e)
        {
            LogUtil.error(e.getStackTrace().toString());
        }
    }
}

+ 224 - 9
Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/config/SysConfig.java

@ -1,7 +1,13 @@
package com.yihu.ehr.common.config;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.model.PatientIdentity;
import com.yihu.ehr.util.encrypt.RSA;
import com.yihu.ehr.util.http.HOPClient;
import com.yihu.ehr.util.http.Response;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.ConfigureUtil;
import com.yihu.ehr.util.operator.StringUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@ -14,13 +20,28 @@ import java.util.List;
public class SysConfig {
    public static final String HOS_RESOURCES_CONFIG = "/config/sys.config.xml";
    public static String publicKey;
    public static String orgCode;
    public static String tempFile;
    public static String registerDataSet;
    public static String registerIdCardNo;
    public static String publicKeyMethod;
    public static String tokenMethod;
    private static volatile SysConfig instance = null;
    public static String orgCode;
    private String platformUrl;
    private boolean debugMode;
    private String tempFile;
    private String publicKey;
    private HashMap<String, PatientIdentity> patientIdentityHashMap;
    private String trustStorePath;
    private String trustStorePwd;
    private String registerDataSet;
    private String registerIdCardNo;
    private String platformUserName;
    private String platformUserPass;
    private String platformAppId;
    private String platformAppSecret;
    private String accessToken;
    private String refreshToken;
    private String platformUser;
    private String basciAuthPwd;
    private String basciAuthUser;
    private SysConfig() {
        patientIdentityHashMap = new HashMap<>();
@ -48,6 +69,10 @@ public class SysConfig {
    }
    public Boolean isDebugMode() {
        return debugMode;
    }
    public String getTempFile() {
        return this.tempFile;
    }
@ -56,12 +81,65 @@ public class SysConfig {
        this.tempFile = tempFile;
    }
    public String getPublicKey() {
        return publicKey;
    public void setTrustStorePath(String trustStorePath) {
        this.trustStorePath = trustStorePath;
        HOPCLientInit();
    }
    public void setPublicKey(String publicKey) {
        this.publicKey = publicKey;
    public String getPlatformUrl() {
        return platformUrl;
    }
    /**
     * @return String
     * @throws Exception
     * @modify 2015.09.15 airhead 修订日志信息不对问题
     */
    public String getPublicKey() throws Exception {
        if (publicKey != null) {
            return publicKey;
        }
        if (publicKeyMethod == null) {
            publicKeyMethod = ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.security.publicKey.get");
        }
        HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
        hopClient.setAppId(SysConfig.getInstance().getPlatformAppId());
        hopClient.setUrl(SysConfig.getInstance().getPlatformUrl());
        hopClient.setMethod(publicKeyMethod + platformUserName);
        Response response = hopClient.get();
        if (response == null) {
            LogUtil.fatal("获取公钥失败.");
            return null;
        }
        if (response.statusCode != 200) {
            LogUtil.fatal("获取公钥失败,错误代码:" + response.statusCode);
            return null;
        }
        try {
            ObjectMapper mapper = new ObjectMapper();
            JsonNode rootNode = mapper.readValue(response.body, JsonNode.class);
            String code = rootNode.path("code").asText();
            if ("ehr.invalid.user".equals(code)) {
                LogUtil.fatal("获取公钥失败:无效用户,请检查 Sys.config.xml文件中 <user>节点值是否正确");
                return null;
            }
            JsonNode publicNode = rootNode.path("result").path("public_key");
            if (publicNode.isMissingNode()) {
                LogUtil.fatal("获取公钥失败,返回数据格式不正确.");
                return null;
            }
            publicKey = publicNode.asText();
        } catch (Exception e) {
            LogUtil.fatal("获取公钥失败,返回数据格式不正确.");
            return null;
        }
        return publicKey;
    }
    public PatientIdentity getPatientIdentity(String dataSetCode) {
@ -80,6 +158,105 @@ public class SysConfig {
        return registerIdCardNo;
    }
    /**
     * @return String
     * @modify 2015.09.15 airhead 修订日志信息不对问题
     */
    public String getAccessToken() {
        try {
            if (tokenMethod == null) {
                tokenMethod = ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.security.token.get");
            }
            HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
            hopClient.setAppId(SysConfig.getInstance().getPlatformAppId());
            hopClient.setUrl(SysConfig.getInstance().getPlatformUrl());
            hopClient.setMethod(tokenMethod);
//            hopClient.setParam("grant_type", "password");
            hopClient.setParam("user_name", getPlatformUserName());
            hopClient.setParam("app_secret", SysConfig.getInstance().getPlatformAppSecret());
            String publicKey = getPublicKey();
            String encryptPwd = RSA.encrypt(platformUserPass, RSA.genPublicKey(publicKey));
            hopClient.setParam("rsa_pw", encryptPwd);
            Response response = hopClient.get();
            if (response == null) {
                LogUtil.fatal("获取令牌失败.");
                return null;
            }
            if (response.statusCode != 200) {
                LogUtil.fatal("获取令牌失败,错误代码:" + response.statusCode);
                return null;
            }
            ObjectMapper mapper = new ObjectMapper();
            JsonNode rootNode = mapper.readValue(response.body, JsonNode.class);
            String code = rootNode.path("code").asText();
            if (code.equals("ehr.invalid.username.or.pwd")) {
                LogUtil.fatal("无效用户名或密码,请检查Sys.config.xml文件中 <user>节点值是否正确");
                return null;
            }
            if (code.equals("ehr.app.register.invalid")) {
                LogUtil.fatal("该app应用在系统中不存在,请检查Sys.config.xml文件中 <app>节点值是否正确");
                return null;
            }
            if (code.equals("ehr.security.token.expired") && !StringUtil.isEmpty(refreshToken)) {
                hopClient.reset();
                hopClient.setMethod(tokenMethod);
                hopClient.setAppId(SysConfig.getInstance().getPlatformAppId());
                hopClient.setParam("grant_type", "password");
                hopClient.setParam("refresh_token", refreshToken);
                hopClient.setParam("user_id", getPlatformUserName());
                response = hopClient.get();
                if (response == null) {
                    LogUtil.fatal("刷新令牌失败.");
                    return null;
                }
                if (response.statusCode != 200) {
                    LogUtil.fatal("刷新令牌失败,错误代码:" + response.statusCode);
                    return null;
                }
                rootNode = mapper.readValue(response.body, JsonNode.class);
                code = rootNode.path("code").asText();
                if (StringUtil.isEmpty(code) || !code.equals("0")) {
                    LogUtil.fatal("刷新令牌失败,错误代码:" + code);
                    return null;
                }
            }
            accessToken = rootNode.path("result").get("access_token").asText();
            refreshToken = rootNode.path("result").path("refresh_token").asText();
            return accessToken;
        } catch (Exception e) {
            LogUtil.error(e);
        }
        return null;
    }
    public String getPlatformUser() {
        return platformUser;
    }
    public String getPlatformUserName() {
        return platformUserName;
    }
    public String getPlatformAppId() {
        return platformAppId;
    }
    private String getPlatformAppSecret() {
        return platformAppSecret;
    }
    private Document getDocument() throws DocumentException {
        SAXReader reader = new SAXReader();
        Document document = null;
@ -105,13 +282,43 @@ public class SysConfig {
                return;
            }
            this.initPlatForm(rootElement);
            this.initCrawler(rootElement);
            this.initEventNo(rootElement);
            String debug = rootElement.elementTextTrim("debug");
            if (StringUtil.isEmpty(debug) || debug.equals("false")) {
                debugMode = false;
            }
        } catch (Exception e) {
            LogUtil.error(e);
        }
    }
    private void initPlatForm(Element rootElement) throws Exception {
        Element platform = rootElement.element("platform");
        String platformUrl = platform.elementTextTrim("url");
        if (!StringUtil.isEmpty(platformUrl)) {
            this.platformUrl = platformUrl;
        }
        Element trustStore = platform.element("trust_store");
        trustStorePwd = trustStore.attributeValue("pwd");
        Element platformUserElem = platform.element("user");
        platformUserName = platformUserElem.getTextTrim();
        platformUserPass = platformUserElem.attributeValue("pwd");
        Element platformAppElem = platform.element("app");
        platformAppId = platformAppElem.getTextTrim();
        platformAppSecret = platformAppElem.attributeValue("secret");
        Element basciAuthElem = platform.element("basic_auth");
        basciAuthUser = basciAuthElem.getTextTrim();
        basciAuthPwd = basciAuthElem.attributeValue("pwd");
        HOPClient.initBasciAuth(basciAuthUser, basciAuthPwd);
    }
    private void initCrawler(Element rootElement) {
        List queueDataSets = rootElement.element("patient_queue").elements("dataset");
        for (Object obj : queueDataSets) {
@ -142,6 +349,14 @@ public class SysConfig {
        }
    }
    private void HOPCLientInit () {
        try {
            HOPClient.initHttps(trustStorePath, trustStorePwd);
        } catch (Exception e) {
            LogUtil.error(e);
        }
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

+ 0 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/config/ThreadConfig.java

@ -6,5 +6,4 @@ public class ThreadConfig {
    public static int UPDATE_THREAD_SLEEP_TIME = 60;
    public static int CRAWLER_SUPPLY_THREAD_SLEEP_TIME = 60;
}

+ 0 - 20
Hos-Resource-Mini/src/main/java/com.yihu.ehr/common/constants/Constants.java

@ -69,24 +69,4 @@ public class Constants {
    public static final String MYSQL = "mysql";
    public static final String ORACLE = "oracle";
    public static final String SQLSERVER = "sqlserver";
    //===========================开放接口参数 start=============================
    /**
     * 获取就诊病人列表(GetPatientQueue)
     */
    public static final String GETPATIENTQUEUE="01001";
    /**
     *获取就诊病人档案数据集(GetPatientDataset)
     */
    public static final String GETPATIENTDATASET="01002";
    /**
     * 上传就诊病人档案数据集(PostPatientDataset)
     */
    public static final String POSTPATIENTDATASET="01003";
    // 09开头的都是系统级别
    public static final String SYSTEM_ERROR="09000";
    public static final String SYSTEM_PARAMS="09001";
    public static final String SYSTEM_PARAMS_MESSAGE="参数错误";
    //===========================开放接口参数 end=============================
}

+ 0 - 169
Hos-Resource-Mini/src/main/java/com.yihu.ehr/controller/DataAcquisitionController.java

@ -1,169 +0,0 @@
package com.yihu.ehr.controller;
import com.yihu.ehr.common.constants.Constants;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.model.DataAcquistion;
import com.yihu.ehr.model.RespResult;
import com.yihu.ehr.service.intf.IDataAcquisitionManager;
import com.yihu.ehr.util.operator.StringUtil;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2016/3/18.
 */
@Controller
@RequestMapping("/dataAcquisition")
public class DataAcquisitionController {
    @Autowired
    private IDataAcquisitionManager dataAcquisitionManager;
    private DBHelper db = new DBHelper();
    @RequestMapping(value = "/getData")
    @ResponseBody
    public RespResult getData(HttpServletRequest request) throws Exception {
        RespResult r = new RespResult();
        try {
            String transactionCode = request.getParameter("transactionCode");
            //判断transactionCode是否错误
            if (StringUtil.isEmpty(transactionCode)) {
                r.setRespCode(Constants.SYSTEM_ERROR);
                r.setRespMessage("transactionCode为空");
                return r;
            }
            //根据transactionCode查找数据库
            List<JSONObject> list = db.query("select * from data_acquisition where transactioncode='" + transactionCode + "'");
            if (list == null && list.size() == 0) {
                r.setRespCode(Constants.SYSTEM_ERROR);
                r.setRespMessage("transactionCode不存在");
                return r;
            }
            //得到参数
            Map<String, String[]> paramsMap = request.getParameterMap();
            Map<String, Object> params = new HashMap<String, Object>();
            for (Map.Entry<String, String[]> a : paramsMap.entrySet()) {
                params.put(a.getKey(), a.getValue()[0]);
            }
            JSONObject jo = list.get(0);
            r.setData(dataAcquisitionManager.gate(jo, params));
            //根据参数选择业务函数
            r.setTransactionCode(transactionCode);
        } catch (Exception e) {
            r.setRespCode(Constants.SYSTEM_ERROR);
            r.setRespMessage(e.getMessage());
        }
        return r;
    }
    /*
   系统参数页面
    */
    @RequestMapping("/dataAcquisitionManager")
    public String paramManager(Model model) {
        try {
            model.addAttribute("contentPage", "/datacquisition/dataAcquistion");
            return "partView";
        } catch (Exception ex) {
            model.addAttribute("errorMessage", ex.getMessage());
            return "error";
        }
    }
    @RequestMapping("getDataAcquisition")
    @ResponseBody
    public Result getDataAcquisition(int page, int rows) {
        try {
            return dataAcquisitionManager.getDataAcquisition(page, rows);
        } catch (Exception ex) {
            return Result.error(ex.getMessage());
        }
    }
    @RequestMapping("editorDataAcq")
    public String editorDataAcq(Model model, String dataId) {
        try {
            //是否编辑
            if (dataId != null && dataId.length() > 0) {
                //获取菜单信息
                DataAcquistion jsonS = dataAcquisitionManager.getDataAcquisitionById(dataId);
                model.addAttribute("model", jsonS);
            }
            model.addAttribute("contentPage", "datacquisition/editorDataAcq");
            return "pageView";
        } catch (Exception ex) {
            model.addAttribute("contentPage", "datacquisition/editorDataAcq");
            return "pageView";
        }
    }
    @RequestMapping("addDataAcquisition")
    @ResponseBody
    public Result addDataAcquisition(HttpServletRequest request) {
        try {
            String url = request.getParameter("url");
            String request_type = request.getParameter("request_type");
            String transactioncode = request.getParameter("transactioncode");
            String url_type = request.getParameter("url_type");
            String name = request.getParameter("name");
            if (dataAcquisitionManager.getDataAcquisitionByCode(transactioncode) != null) {
                return Result.error("接口代码已经存在");
            }
            if (dataAcquisitionManager.getDataAcquisitionByName(name) != null) {
                return Result.error("接口名称已经存在");
            }
            return dataAcquisitionManager.addDataAcquisition(url, request_type, transactioncode, url_type, name);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    @RequestMapping("updateDataAcquisition")
    @ResponseBody
    public Result updateDataAcquisition(HttpServletRequest request) {
        try {
            String url = request.getParameter("url");
            String id = request.getParameter("id");
            String request_type = request.getParameter("request_type");
            String transactioncode = request.getParameter("transactioncode");
            String url_type = request.getParameter("url_type");
            String name = request.getParameter("name");
            if (dataAcquisitionManager.getDataAcquisitionByCode(transactioncode, id) != null) {
                return Result.error("接口代码已经存在");
            }
            if (dataAcquisitionManager.getDataAcquisitionByName(name, id) != null) {
                return Result.error("接口名称已经存在");
            }
            return dataAcquisitionManager.updateDataAcquisition(url, request_type, transactioncode, url_type, name, id);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    @RequestMapping("deleteDataAcquisition")
    @ResponseBody
    public Result deleteDataAcquisition(HttpServletRequest request) {
        try {
            String id = request.getParameter("id");
            return dataAcquisitionManager.deleteAataAcquisition(id);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
}

Різницю між файлами не показано, бо вона завелика
+ 2 - 36
Hos-Resource-Mini/src/main/java/com.yihu.ehr/controller/SystemController.java


+ 0 - 61
Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/DataAcquistion.java

@ -1,61 +0,0 @@
package com.yihu.ehr.model;
/**
 * Created by chenweida on 2016/3/28.
 */
public class DataAcquistion {
    private String id;
    private String url;
    private String name;
    private String transactioncode;
    private String request_type;
    private String url_type;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTransactioncode() {
        return transactioncode;
    }
    public void setTransactioncode(String transactioncode) {
        this.transactioncode = transactioncode;
    }
    public String getRequest_type() {
        return request_type;
    }
    public void setRequest_type(String request_type) {
        this.request_type = request_type;
    }
    public String getUrl_type() {
        return url_type;
    }
    public void setUrl_type(String url_type) {
        this.url_type = url_type;
    }
}

+ 0 - 57
Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/RespResult.java

@ -1,57 +0,0 @@
package com.yihu.ehr.model;
/**
 * Created by chenweida on 2016/3/21.
 * 开放接口返回的实体类
 */
public class RespResult {
    String transactionCode;
    String respCode="10000";
    String respMessage="成功";
    String page;
    String data;
    public String getTransactionCode() {
        return transactionCode;
    }
    public void setTransactionCode(String transactionCode) {
        this.transactionCode = transactionCode;
    }
    public String getRespCode() {
        return respCode;
    }
    public void setRespCode(String respCode) {
        this.respCode = respCode;
    }
    public String getRespMessage() {
        return respMessage;
    }
    public void setRespMessage(String respMessage) {
        this.respMessage = respMessage;
    }
    public String getPage() {
        return page;
    }
    public void setPage(String page) {
        this.page = page;
    }
    public String getData() {
        return data;
    }
    public void setData(String data) {
        this.data = data;
    }
}

+ 0 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/entity/adapter/AdapterDict.java

@ -34,7 +34,6 @@ public class AdapterDict extends BaseEntity {
        if (json == null || json.isNull("std_dict_item_code")) {
            return new String(INVALID_ADAPTER_DICT);
        }
        return json.getString("std_dict_item_code");
    }

+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/model/entity/adapter/AdapterMetaData.java

@ -65,7 +65,7 @@ public class AdapterMetaData extends BaseEntity {
                if (!json.isNull("dict_code")) {
                    stdMetaDataT.setDictCode(json.getString("dict_code"));
                }
                if (!json.isNull("dict_value_type") && json.getString("dict_value_type").length()>0) {
                if (!json.isNull("dict_value_type")) {
                    stdMetaDataT.setDictValueType(json.getInt("dict_value_type"));
                }
            }

+ 0 - 182
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/DataAcquisitionManager.java

@ -1,182 +0,0 @@
package com.yihu.ehr.service;
import com.yihu.ehr.dbhelper.common.DBList;
import com.yihu.ehr.dbhelper.common.DBQuery;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.framework.model.DataGridResult;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.model.DataAcquistion;
import com.yihu.ehr.service.intf.IDataAcquisitionManager;
import com.yihu.ehr.util.httpclient.HttpHelper;
import com.yihu.ehr.util.json.JSON;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Map;
import java.util.UUID;
/**
 * Created by chenweida on 2016/3/18.
 */
@Service("dataAcquisitionManager")
public class DataAcquisitionManager implements IDataAcquisitionManager {
    DBQuery query = new DBQuery();
    DBHelper db = new DBHelper();
    @Override
    public String gate(JSONObject jo, Map<String, Object> params) {
        String responMsg = "";
        String path = (String) jo.get("url");
        String requestType = (String) jo.get("request_type");//1是查询 2是文件上传
        String urlType = (String) jo.get("url_type");//1是post 2是 get
        //判断是http请求还是https
        responMsg = getResponMsg(path, requestType, urlType, params);
        return responMsg;
    }
    @Override
    public Result getDataAcquisition(int page, int size) throws Exception {
        String sql = "select * from data_acquisition where 1=1";
        DBList list = query.queryBySql(sql, page, size);
        return DataGridResult.fromDBList(list);
    }
    @Override
    public DataAcquistion getDataAcquisitionById(String dataId) throws Exception {
        String sql = "select * from data_acquisition where id='" + dataId + "'";
        DBList list = query.queryBySql(sql);
        if (list != null && list.getList().size() > 0) {
            DataAcquistion d = new DataAcquistion();
            d.setId((String) list.getList().get(0).get("id"));
            d.setName((String) list.getList().get(0).get("name"));
            d.setRequest_type((String) list.getList().get(0).get("request_type"));
            d.setTransactioncode((String) list.getList().get(0).get("transactioncode"));
            d.setUrl((String) list.getList().get(0).get("url"));
            d.setUrl_type((String) list.getList().get(0).get("url_type"));
            return d;
        } else {
            return null;
        }
    }
    @Override
    public Result addDataAcquisition(String url, String request_type, String transactioncode, String url_type, String name) throws Exception {
        String sql = "insert into data_acquisition (id,url,request_type,transactioncode,url_type,name) values " +
                "('" + UUID.randomUUID() + "'," +
                " '" + url + "' ," +
                " '" + request_type + "' ," +
                " '" + transactioncode + "' ," +
                " '" + url_type + "' ," +
                " '" + name + "' " +
                ")";
        db.execute(sql);
        return Result.success("保存成功");
    }
    @Override
    public Result getDataAcquisitionByCode(String transactioncode) throws Exception {
        String sql = "select * from data_acquisition where transactioncode='" + transactioncode + "'";
        DBList list = query.queryBySql(sql);
        if (list.getList() != null && list.getList().size() > 0) {
            return DataGridResult.fromDBList(list);
        } else {
            return null;
        }
    }
    @Override
    public Object getDataAcquisitionByName(String name) throws Exception {
        String sql = "select * from data_acquisition where name='" + name + "'";
        DBList list = query.queryBySql(sql);
        if (list.getList() != null && list.getList().size() > 0) {
            return DataGridResult.fromDBList(list);
        } else {
            return null;
        }
    }
    @Override
    public Object getDataAcquisitionByCode(String transactioncode, String id) throws Exception {
        String sql = "select * from data_acquisition where transactioncode='" + transactioncode + "' and id !='" + id + "'";
        DBList list = query.queryBySql(sql);
        if (list.getList() != null && list.getList().size() > 0) {
            return DataGridResult.fromDBList(list);
        } else {
            return null;
        }
    }
    @Override
    public Object getDataAcquisitionByName(String name, String id) throws Exception {
        String sql = "select * from data_acquisition where name='" + name + "' and id !='" + id + "'";
        DBList list = query.queryBySql(sql);
        if (list.getList() != null && list.getList().size() > 0) {
            return DataGridResult.fromDBList(list);
        } else {
            return null;
        }
    }
    @Override
    public Result updateDataAcquisition(String url, String request_type, String transactioncode, String url_type, String name, String id) throws Exception {
        String sql = "update data_acquisition set " +
                " url= '" + url + "' ," +
                " request_type='" + request_type + "' ," +
                " transactioncode='" + transactioncode + "' ," +
                " url_type='" + url_type + "' ," +
                " name='" + name + "' where id='" + id + "'";
        db.execute(sql);
        return Result.success("更新成功");
    }
    @Override
    public Result deleteAataAcquisition(String id) throws Exception {
        String sql = "delete from data_acquisition  where id='" + id + "'";
        db.execute(sql);
        return Result.success("删除成功");
    }
    private String getResponMsg(String path, String requestType, String urlType, Map<String, Object> params) {
        //1是拉推数据
        String responseMsg = "";
        if ("1".equals(requestType)) {
            if ("1".equals(urlType)) {
                //post
                responseMsg = HttpHelper.post(path, params).getBody();
            } else if ("2".equals(urlType)) {
                //get
                responseMsg = HttpHelper.get(path, params).getBody();
            }
            //2文件上传
        } else if ("2".equals(requestType)) {
            /*
            if ("1".equals(urlType)) {
                //post
                responseMsg = HttpHelper.post(path, params).getBody();
            } else if ("2".equals(urlType)) {
                //get
                responseMsg = HttpHelper.get(path, params).getBody();
            }
            */
            File f = JSON.json2File(params);
            //文件上传
           // if ("1".equals(urlType)) {
                //post
            //    responseMsg = HttpHelper.postFile(path, null, f).getBody();
            //}
            responseMsg = HttpHelper.postFile(path, null, f).getBody();
            //删除文件
            f.delete();
        }
        return responseMsg;
    }
}

+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/DatacollectManager.java

@ -95,7 +95,7 @@ public class DatacollectManager implements IDatacollectManager {
    @Override
    public DataGridResult getJobRepeat(int page,int size) throws Exception
    {
        String sql = "select * from crawler_supply where 1=1 and start_time is not null and end_time is not null";
        String sql = "select * from crawler_supply where 1=1";
        DBList list = query.queryBySql(sql,page,size);

+ 78 - 108
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/SystemManager.java

@ -2,8 +2,6 @@ package com.yihu.ehr.service;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.common.config.ThreadConfig;
import com.yihu.ehr.dbhelper.common.enums.CommonEnum;
import com.yihu.ehr.dbhelper.jdbc.DBDriver;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.model.DataSource;
@ -12,17 +10,15 @@ import com.yihu.ehr.model.UserInfo;
import com.yihu.ehr.service.intf.ISystemManager;
import com.yihu.ehr.service.thread.StandardUpdateThread;
import com.yihu.ehr.service.thread.ThreadManage;
import com.yihu.ehr.util.http.HOPClient;
import com.yihu.ehr.util.httpclient.EsbHttp;
import com.yihu.ehr.util.httpclient.Response;
import com.yihu.ehr.util.operator.ConfigureUtil;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpSession;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Enumeration;
import java.util.List;
import java.util.UUID;
@ -151,128 +147,102 @@ public class SystemManager implements ISystemManager {
    测试数据源
     */
    @Override
    public Result testDataSource(String uri) {
        try {
            DBDriver.registerDriver(uri);
            Connection conn = DriverManager.getConnection(uri);
            if(conn!=null) {
                String message="连接测试成功!";
                if(conn.isClosed())
                {
                    message = "连接测试失败!";
                }
                conn.close();
                return Result.success(message);
            }
            else {
                return Result.error("连接测试失败!");
    public Result testDataSource(String config) throws Exception {
        DBHelper db = new DBHelper(config, config);
        if (db.test()) {
            return Result.success("连接测试成功!");
        } else {
            if (db.errorMessage.length() > 0) {
                return Result.error(db.errorMessage);
            } else {
                return Result.error("连接测试成失败!");
            }
        }
        catch (Exception ex)
        {
            return Result.error(ex.getMessage());
        }
    }
    /*
    登录操作
    */
    @Override
    public Result loginAction(HttpSession session, String user, String password) {
        try {
            //特殊用户
            if (user.equals("admin") && password.equals("JKZL")) {
                UserInfo obj = new UserInfo();
                obj.setLoginCode("admin");
                obj.setRealName("管理员");
                obj.setOrgCode("JKZL");
                obj.setOrgName("健康之路");
                session.setAttribute("userInfo", obj);
                return Result.success("登录成功!");
            }
            //根据用户名/密码到总平台校验
            Response response = EsbHttp.loginAction(user, password);
    public Result loginAction(HttpSession session, String user, String password) throws Exception {
        //特殊用户
        if (user.equals("admin") && password.equals("JKZL")) {
            UserInfo obj = new UserInfo();
            obj.setLoginCode("admin");
            obj.setRealName("管理员");
            obj.setOrgCode("JKZL");
            obj.setOrgName("健康之路");
            session.setAttribute("userInfo", obj);
            return Result.success("登录成功!");
        }
            if (response != null && response.getStatusCode() == 200) {
                JSONObject obj = new JSONObject(response.getBody());
                if (obj.has("token"))//登录成功
                {
                    String token = obj.getString("token");
                    //获取用户信息
                    Response re = EsbHttp.getUserInfo(user, token);
                    if (re != null && re.getStatusCode() == 200) {
                        JSONObject userObject = new JSONObject(re.getBody());
                        UserInfo userInfo = new UserInfo();
                        userInfo.setLoginCode(user);
                        userInfo.setRealName(userObject.getString("realName"));
                        String orgCode = "";
                        String orgName = "";
                        if(userObject.has("organization") && !userObject.get("organization").equals(null)) {
                            JSONObject orgInfo = userObject.getJSONObject("organization");
                            orgCode = orgInfo.getString("orgCode");
                            orgName = orgInfo.getString("fullName");
                            userInfo.setOrgCode(orgCode);
                            userInfo.setOrgName(orgName);
                        }
                        else{
                            return Result.error("该用户未配置机构!");
                        }
                        session.setAttribute("userInfo", userInfo);
        //根据用户名/密码到总平台校验
        Response response = EsbHttp.loginAction(user, password);
                        //判断组织编码是否为空
                        String orgCodeOld = this.getSystemParam("ORG_CODE");
                        if (orgCodeOld==null || orgCodeOld.length() == 0) {
                            this.saveSystemParams("FINGER_PRINT", UUID.randomUUID().toString());
                            this.saveSystemParams("ORG_CODE", orgCode);
                            this.saveSystemParams("ORG_NAME", orgName);
                            //启动标准
                            SysConfig.getInstance().setOrgCode(orgCode);
                            Thread standardUpdateThread = new Thread(new StandardUpdateThread());
                            ThreadManage.add(ThreadManage.STANDARD_UPDATE_THREAD, standardUpdateThread);
                            ThreadManage.setUpdateInterval();
                            if (!standardUpdateThread.isAlive()) {
                                standardUpdateThread.start();
                            }
                            return Result.success("登录成功!");
                        }
                        else {
                            if (orgCodeOld.equals(orgCode)) {
                                return Result.success("登录成功!");
                            } else {
                                return Result.error("机构编码不一致!");
                            }
                        }
                    }
                    else{
                        return Result.error("获取用户信息失败!");
                    }
        if (response == null || response.statusCode != 200) {
            return Result.error("登录失败!网络错误或者服务器不可用。");
        }
        try {
            JSONObject obj = new JSONObject(response.body);
            if (obj.has("token"))//登录成功
            {
                String token = obj.getString("token");
                //获取用户信息
                Response re = EsbHttp.getUserInfo(user, token);
                JSONObject userObject = new JSONObject(re.body);
                UserInfo userInfo = new UserInfo();
                userInfo.setLoginCode(user);
                userInfo.setRealName(userObject.getString("realName"));
                String orgCode = "";
                String orgName = "";
                if(!userObject.get("organization").equals(null)) {
                    JSONObject orgInfo = userObject.getJSONObject("organization");
                    orgCode = orgInfo.getString("orgCode");
                    orgName = orgInfo.getString("fullName");
                    userInfo.setOrgCode(orgCode);
                    userInfo.setOrgName(orgName);
                }
                else{
                    return Result.error("该用户未配置机构!");
                }
                else {
                    if(obj.has("message"))
                    {
                        return Result.error("登录失败!"+obj.getString("message"));
                session.setAttribute("userInfo", userInfo);
                //判断组织编码是否为空
                String orgCodeOld = this.getSystemParam("ORG_CODE");
                if (orgCodeOld==null || orgCodeOld.length() == 0) {
                    this.saveSystemParams("FINGER_PRINT", UUID.randomUUID().toString());
                    this.saveSystemParams("ORG_CODE", orgCode);
                    this.saveSystemParams("ORG_NAME", orgName);
                    //启动标准
                    if (SysConfig.getInstance().isEmptyOrgCode()) {
                        SysConfig.getInstance().setOrgCode(orgCode);
                        Thread standardUpdateThread = new Thread(new StandardUpdateThread());
                        ThreadManage.add(ThreadManage.STANDARD_UPDATE_THREAD, standardUpdateThread);
                        ThreadManage.setUpdateInterval();
                        if (!standardUpdateThread.isAlive()) {
                            standardUpdateThread.start();
                        }
                    }
                    else{
                        return Result.error("登录失败!");
                    return Result.success("登录成功!");
                } else {
                    if (orgCodeOld.equals(orgCode)) {
                        return Result.success("登录成功!");
                    } else {
                        return Result.error("机构编码不一致!");
                    }
                }
            }
            else {
                String msg = "登录失败。";
                if (response != null)
                if(obj.has("message"))
                {
                    msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                    return Result.error("登录失败!"+obj.getString("message"));
                }
                else{
                    return Result.error("登录失败!");
                }
                return Result.error(msg);
            }
        }
        catch (Exception ex) {
            return Result.error(ex.getMessage());

+ 8 - 40
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/CrawlerManager.java

@ -55,13 +55,6 @@ public class CrawlerManager {
    }
    public void dataCrawlerFrequency() {
        List<JSONObject> versionList = db.query("select code from std_inner_version order by code desc");
        if(versionList==null)
        {
            LogUtil.info("标准数据还未初始化,请确认!");
            return;
        }
        String uuid = UUID.randomUUID().toString();
        Date lastCralwerTime = DateUtil.getSysDateTime();
        lastCralwerTime = DateUtil.formatYMDToYMDHMS(lastCralwerTime.toString());
@ -81,13 +74,6 @@ public class CrawlerManager {
    }
    public void dataCrawlerSupply() {
        List<JSONObject> versionList = db.query("select code from std_inner_version order by code desc");
        if(versionList==null)
        {
            LogUtil.info("标准数据还未初始化,请确认!");
            return;
        }
        List<JSONObject> jsonList = db.query("select * from crawler_supply where status != 1");
        if (!CollectionUtil.isEmpty(jsonList)) {
            for (JSONObject json : jsonList) {
@ -95,22 +81,14 @@ public class CrawlerManager {
                db.execute("update crawler_supply set status = 2 where id = '"+id+"'");
                Date startTime = DateUtil.formatYMDToYMDHMS(json.getString("start_time"));
                Date endTime = DateUtil.formatYMDToYMDHMS(json.getString("end_time"));
                String message = "";
                if(startTime!=null && endTime!=null) {
                    LogUtil.info("补采任务开始!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                    if ((endTime.getTime() - startTime.getTime()) <= 0) {
                        LogUtil.info("补采任务提前结束,时间间隔小于或等于0!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                        changeFillMiningStatus(json, "补采任务提前结束,时间间隔小于或等于0!");
                        return;
                    }
                    message = dataCrawler(startTime, endTime, id, 1);
                    LogUtil.info("补采任务结束!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime + "\n" + message);
                }
                else{
                    message = "采集时间范围:" + startTime + "~" + endTime + "无效!";
                    LogUtil.info(message);
                LogUtil.info("补采任务开始!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                if ((endTime.getTime() - startTime.getTime()) <= 0) {
                    LogUtil.info("补采任务提前结束,时间间隔小于或等于0!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime);
                    changeFillMiningStatus(json, "补采任务提前结束,时间间隔小于或等于0!");
                    return;
                }
                String message = dataCrawler(startTime, endTime, id, 1);
                LogUtil.info("补采任务结束!任务ID:" + id + ",采集时间:" + startTime + "~" + endTime + "\n" +message);
                if (!StringUtil.isEmpty(message)) {
                    changeFillMiningStatus(json, message);
                }
@ -127,9 +105,6 @@ public class CrawlerManager {
    }
    public synchronized String dataCrawler(Date begin, Date end, String taskId, int type) {
        if (SysConfig.getInstance().isEmptyOrgCode()) {
            return "本次任务执行失败,机构代码为空";
        }
        Integer count = 0;
        Integer totalCount = 0;
        getAdapterDataSetList();
@ -152,13 +127,6 @@ public class CrawlerManager {
                if (!CollectionUtil.isEmpty(patientList)) {
                    totalCount = patientList.size();
                    for (Patient patient : patientList) {
                        String token;
                        try {
                            token = EsbHttp.getToken();
                        } catch (Exception e) {
                            LogUtil.error("本次任务执行失败,获取token失败!");
                            return "本次任务执行失败,获取token失败!";
                        }
                        if (type == 1) {
                            patient.setReUploadFlg(StringUtil.toString(true));
                        } else {
@ -166,7 +134,7 @@ public class CrawlerManager {
                        }
                        LogUtil.trace("采集->注册->打包上传,任务ID:"+taskId+",patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
                        // COLLECT->REGISTER->UPLOAD
                        Boolean result = dispatch.collectData(patient, adapterDataSetList, dataSourceMap, token);
                        Boolean result = dispatch.collectData(patient, adapterDataSetList, dataSourceMap);
                        SqlCreate sqlCreate = new SqlCreate();
                        sqlCreate.setTableName("task_track");

+ 10 - 14
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/DBOrigin.java

@ -97,26 +97,22 @@ public class DBOrigin {
                if (data == null || ((ArrayNode) data).size() == 0) {
                    return null;
                }
                JSONArray jsonArray = new JSONArray();
                for(int i=0;i<data.size();i++)
                {
                    JsonNode o = data.get(i);
                    JSONObject json = new JSONObject();
                    Iterator fileNames = o.fieldNames();
                JSONObject json = new JSONObject();
                if (data != null && data.get(0) != null) {
                    Iterator fileNames = data.get(0).fieldNames();
                    while (fileNames.hasNext()) {
                        String fieldName = (String)fileNames.next();
                        if (!StringUtil.isEmpty(itemTagMap.get(fieldName))) {
                            json.put(itemTagMap.get(fieldName), o.get(fieldName).asText());
                            json.put(itemTagMap.get(fieldName), data.get(0).get(fieldName).asText());
                        }
                    }
                    if (json.keySet().size() != itemTagMap.keySet().size()) {
                        LogUtil.info("适配数据元数量与机构提供数据元不一致,请确认!");
                        LogUtil.info("视图提供数据元:" + json.keySet().toString() + "适配数据元:" + itemList.toString());
                    }
                    jsonArray.add(json);
                }
                if (json.keySet().size() != itemTagMap.keySet().size()) {
                    LogUtil.info("适配数据元数量与机构提供数据元不一致,请确认!");
                    LogUtil.info("视图提供数据元:" + json.keySet().toString() + "适配数据元:" + itemList.toString());
                }
                JSONArray jsonArray = new JSONArray();
                jsonArray.add(0, json);
                ObjectMapper mapper = new ObjectMapper();
                //JSON ----> JsonNode
                JsonNode jsonNode = mapper.readTree(jsonArray.toString());

+ 56 - 15
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/crawler/DataCollectDispatcher.java

@ -12,13 +12,19 @@ import com.yihu.ehr.service.patient.PatientCDAIndex;
import com.yihu.ehr.service.patient.PatientCDAUpload;
import com.yihu.ehr.util.db.DBSessionFactory;
import com.yihu.ehr.util.file.FileUtil;
import com.yihu.ehr.util.httpclient.EsbHttp;
import com.yihu.ehr.util.http.HOPClient;
import com.yihu.ehr.util.http.Response;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.CollectionUtil;
import com.yihu.ehr.util.operator.ConfigureUtil;
import com.yihu.ehr.util.operator.StringUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
public class DataCollectDispatcher {
@ -39,7 +45,7 @@ public class DataCollectDispatcher {
     * @param patient 病人
     * @return true-采集成功,false-采集失败
     */
    public Boolean collectData(Patient patient, List<AdapterDataSet> adapterDataSetList, Map<String, DBSessionFactory> dataSourceMap, String token) {
    public Boolean collectData(Patient patient, List<AdapterDataSet> adapterDataSetList, Map<String, DBSessionFactory> dataSourceMap) {
        Boolean result = true;
        Map<String, AdapterDataSet> dataSetMap = new HashMap<>();
        List<ObjectNode> dataList = new ArrayList<>();
@ -56,19 +62,17 @@ public class DataCollectDispatcher {
                    if (jsonObject == null) {
                        continue;
                    }
                    if (jsonObject != null && !StringUtil.isEmpty(jsonObject)) {
                        dataSetMap.put(adapterDataSet.getAdapterDataSetT().getStdDatasetCode(), adapterDataSet);
                        dataList.add(jsonObject);
                    }
                    //注册病人
                    if (SysConfig.getInstance().getRegisterDataSet().equals(adapterDataSet.getAdapterDataSetT().getStdDatasetCode())) {
                        if (!StringUtil.isEmpty(jsonObject.get("data")) && !StringUtil.isEmpty(jsonObject.get("data").get(0))) {
                            if (!StringUtil.isEmpty(jsonObject.get("data").get(0).get(SysConfig.getInstance().getRegisterIdCardNo()))) {
                                register(patient, StringUtil.toString(jsonObject), token);
                                register(patient, StringUtil.toString(jsonObject));
                            }
                        }
                    }
                    if (jsonObject != null && !StringUtil.isEmpty(jsonObject)) {
                        dataSetMap.put(adapterDataSet.getAdapterDataSetT().getStdDatasetCode(), adapterDataSet);
                        dataList.add(jsonObject);
                    }
                }
            }
            LogUtil.info("采集病人成功,patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
@ -78,10 +82,9 @@ public class DataCollectDispatcher {
            result = false;
        }
        //上传档案
        try {
            if (!CollectionUtil.isEmpty(dataList)) {
                if (!upload(dataList, patient, dataSetMap, token)) {
                if (!upload(dataList, patient, dataSetMap)) {
                    result = false;
                }
            }
@ -93,7 +96,7 @@ public class DataCollectDispatcher {
        return result;
    }
    public Boolean upload(List<ObjectNode> dataList, Patient patient, Map<String, AdapterDataSet> dataSetMap, String token) {
    public Boolean upload(List<ObjectNode> dataList, Patient patient, Map<String, AdapterDataSet> dataSetMap) {
        Boolean result = true;
        try {
            DataSetTransformer dataTransformer = new DataSetTransformer();
@ -114,7 +117,7 @@ public class DataCollectDispatcher {
                }
            }
            PatientCDAUpload patientCDAUpload = new PatientCDAUpload();
            if (!patientCDAUpload.upload(patient, token)) {
            if (!patientCDAUpload.upload(patient)) {
                result = false;
            }
        } catch (Exception e) {
@ -141,8 +144,46 @@ public class DataCollectDispatcher {
     * @return boolean
     * 注册不是否成功 统一返回true
     */
    public Boolean register(Patient patient, String data, String token) {
        return EsbHttp.register(patient, data, token);
    public Boolean register(Patient patient, String data) {
        if (registerMethod == null) {
            registerMethod = ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.patient.register");
        }
        if (StringUtil.isEmpty(data)){
            LogUtil.info("注册病人信息请求失败:无具体病人信息,patient_id="+patient.getPatientId()+", event_no="+patient.getEventNo());
        }
        HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
        hopClient.setAppId(SysConfig.getInstance().getPlatformAppId());
        hopClient.setUrl(SysConfig.getInstance().getPlatformUrl());
        hopClient.setMethod(registerMethod);
        List<NameValuePair> formParams = new ArrayList<>();
        formParams.add(new BasicNameValuePair("user_info", data));
        Response response = hopClient.postForm(formParams);
        if (response == null) {
            LogUtil.info("注册病人信息请求失败:响应response为null,patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
        }
        if (response.statusCode != 200) {
            LogUtil.info("注册病人信息请求失败.错误代码:" + response.statusCode + "patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
        }
        ObjectMapper mapper = new ObjectMapper();
        JsonNode rootNode = null;
        try {
            rootNode = mapper.readValue(response.body, JsonNode.class);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        JsonNode codeNode = rootNode.get("code");
        JsonNode messageNode = rootNode.get("message");
        String result = codeNode.asText();
        String message = messageNode.asText();
        if (!result.equals("0") || "true".equals(message)) {
            LogUtil.info("注册病人信息请求失败.失败信息:" + message + rootNode.get("message").asText() + "patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
            return false;
        } else {
            LogUtil.info("注册病人信息成功,patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
            return true;
        }
    }

+ 0 - 34
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/intf/IDataAcquisitionManager.java

@ -1,34 +0,0 @@
package com.yihu.ehr.service.intf;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.model.DataAcquistion;
import org.json.JSONObject;
import java.util.Map;
/**
 * Created by chenweida on 2016/3/18.
 */
public interface IDataAcquisitionManager {
    String gate(JSONObject jo, Map<String,Object> params);
    Result getDataAcquisition(int page, int rows) throws  Exception;
    DataAcquistion getDataAcquisitionById(String dataId)throws  Exception;
    Result addDataAcquisition(String url, String request_type, String transactioncode, String url_type, String name)throws  Exception;
    Result getDataAcquisitionByCode(String transactioncode)throws  Exception;
    Object getDataAcquisitionByName(String name)throws  Exception;
    Object getDataAcquisitionByCode(String transactioncode, String id)throws  Exception;
    Object getDataAcquisitionByName(String name, String id)throws  Exception;
    Result updateDataAcquisition(String url, String request_type, String transactioncode, String url_type, String name, String id)throws  Exception;
    Result deleteAataAcquisition(String id)throws  Exception;
}

+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/intf/ISystemManager.java

@ -21,7 +21,7 @@ public interface ISystemManager {
    Result saveDataSource(String id,String name,String config) throws Exception;
    Result testDataSource(String uri) throws Exception;
    Result testDataSource(String config) throws Exception;
    Result loginAction(HttpSession session ,String user,String password) throws Exception;
}

+ 51 - 12
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/patient/PatientCDAUpload.java

@ -1,12 +1,17 @@
package com.yihu.ehr.service.patient;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.model.Patient;
import com.yihu.ehr.util.compress.Zipper;
import com.yihu.ehr.util.encrypt.MD5;
import com.yihu.ehr.util.encrypt.RSA;
import com.yihu.ehr.util.file.FileUtil;
import com.yihu.ehr.util.httpclient.EsbHttp;
import com.yihu.ehr.util.http.HOPClient;
import com.yihu.ehr.util.http.Response;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.ConfigureUtil;
import java.io.File;
import java.security.Key;
@ -29,7 +34,7 @@ public class PatientCDAUpload {
     * @modify 2015.09.15 airhead 修订删除目录
     * @modify 2015.09.19 airhead 修复无文档问题及错误信息
     */
    public Boolean upload(Patient patient, String token) {
    public Boolean upload(Patient patient) {
        ZipFile zipFile = zip(patient);
        try {
            if (zipFile == null || zipFile.file == null) {
@ -37,7 +42,7 @@ public class PatientCDAUpload {
                return false;
            }
            boolean result = upload(patient, zipFile, token);
            boolean result = upload(patient, zipFile);
            if (!result) {
                LogUtil.fatal("上传病人档案失败,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return result;
@ -68,13 +73,7 @@ public class PatientCDAUpload {
            String filePath = patientCDAIndex.createIndex(PatientCDAIndex.IndexType.ZIP, PatientCDAIndex.FileType.ZIP);
            UUID uuidPwd = UUID.randomUUID();
            String pwd = uuidPwd.toString();
            String PublicKey = SysConfig.getInstance().getPublicKey();
            if(PublicKey== null ||  PublicKey.length() == 0) {
                PublicKey = EsbHttp.getPublicKey();
                SysConfig.getInstance().setPublicKey(PublicKey);
            }
            Key key = RSA.genPublicKey(PublicKey);
            Key key = RSA.genPublicKey(SysConfig.getInstance().getPublicKey());
            if (key == null) {
                LogUtil.fatal("压缩文件错误,获取公钥错误.");
                return null;
@ -97,8 +96,48 @@ public class PatientCDAUpload {
        return null;
    }
    private boolean upload(Patient patient, ZipFile zipFile, String token) {
        return EsbHttp.upload(patient, zipFile.file, zipFile.encryptPwd, token);
    private boolean upload(Patient patient, ZipFile zipFile) {
        try {
            if (uploadMethod == null) {
                uploadMethod = ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.patient.upload");
            }
            String fileMd5= MD5.getMd5ByFile(zipFile.file);
            HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
            hopClient.setAppId(SysConfig.getInstance().getPlatformAppId());
            hopClient.setUrl(SysConfig.getInstance().getPlatformUrl());
            hopClient.setMethod(uploadMethod);
            hopClient.setParam("md5", fileMd5);
            hopClient.setParam("package_crypto", zipFile.encryptPwd);
            hopClient.setParam("user_name", SysConfig.getInstance().getPlatformUserName());
            Response response = hopClient.postFile(zipFile.file.getAbsolutePath());
            if (response == null) {
                LogUtil.fatal("上传病人档案请求失败,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return false;
            }
            if (response.statusCode != 200) {
                LogUtil.fatal("上传病人档案请求失败,错误代码:" + response.statusCode + ",patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return false;
            }
            ObjectMapper mapper = new ObjectMapper();
            JsonNode rootNode = mapper.readValue(response.body, JsonNode.class);
            JsonNode codeNode = rootNode.get("code");
            String result = codeNode.asText();
            if (!result.equals("0")) {
                LogUtil.fatal("上传病人档案失败,错误代码:" + result + ",patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return false;
            } else {
                LogUtil.info("上传病人档案成功,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return true;
            }
        } catch (Exception e) {
            LogUtil.fatal("上传病人档案异常,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
            LogUtil.error(e);
            return false;
        }
    }
    private class ZipFile {

+ 157 - 54
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/standard/StandardManager.java

@ -1,13 +1,19 @@
package com.yihu.ehr.service.standard;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.common.constants.Constants;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.util.compress.Zipper;
import com.yihu.ehr.util.encode.Base64;
import com.yihu.ehr.util.encrypt.RSA;
import com.yihu.ehr.util.httpclient.EsbHttp;
import com.yihu.ehr.util.httpclient.HttpClientUtil;
import com.yihu.ehr.util.httpclient.Response;
import com.yihu.ehr.util.file.FileUtil;
import com.yihu.ehr.util.http.HOPClient;
import com.yihu.ehr.util.http.Response;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.CollectionUtil;
import com.yihu.ehr.util.operator.ConfigureUtil;
import com.yihu.ehr.util.operator.SqlCreate;
import com.yihu.ehr.util.operator.StringUtil;
import org.dom4j.Document;
@ -16,19 +22,30 @@ import org.dom4j.io.SAXReader;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.security.Key;
import java.util.*;
/**
 * 标准管理,负责版本的升级,解包及相关安全
 *
 * @created Created by Air on 2015/6/3.
 */
public class StandardManager {
    public static String versionMethod;
    public static String downMethod;
    private static volatile StandardManager instance;
    private DBHelper db;
    private SysConfig sysConfig;
    private String downloadFilePath;
    private String encryptPwd;
    private File[] zipFiles;
    private String localVersion;
    private String remoteVersion;
    public StandardManager(){
        if (db == null) {
            db = new DBHelper();
        }
        sysConfig = SysConfig.getInstance();
    }
@ -61,13 +78,14 @@ public class StandardManager {
        return true;
    }
    public Boolean checkUpdate(String remoteVersion) {
    public Boolean checkUpdate() {
        try {
            if (StringUtil.isEmpty(remoteVersion)) {
            getRemoteVersion();
            if (remoteVersion == null) {
                LogUtil.warn("总支撑平台尚无可用版本进行标准升级");
                return false;
            }
            String localVersion = getCurrentVersion();
            localVersion = getCurrentVersion();
            if (StringUtil.isEmpty(localVersion)) {
                return true;
            }
@ -85,19 +103,13 @@ public class StandardManager {
    }
    public boolean update() {
        if (sysConfig.isEmptyOrgCode()) {
            LogUtil.fatal("当前机构代码为空,版本无法更新,请确认!");
            return false;
        }
        String remoteVersion = getRemoteVersion(sysConfig.getOrgCode());
        if (checkUpdate(remoteVersion)) {
            String encryptPwd = download(remoteVersion, sysConfig.getOrgCode());
            if (StringUtil.isEmpty(encryptPwd)) {
        if (checkUpdate()) {
            boolean result = download();
            if (!result) {
                LogUtil.fatal("下载标准包错误.");
                return false;
            }
            versionUpdate(encryptPwd);
            localVersion = remoteVersion;
            versionUpdate();
        }
        return true;
    }
@ -108,14 +120,50 @@ public class StandardManager {
     * @return String
     */
    public synchronized String getCurrentVersion() {
        if (StringUtil.isEmpty(localVersion)){
            localVersion = new StandardService().getCurrentVersion();
        if (!StringUtil.isEmpty(localVersion)){
            return localVersion;
        }
        List<JSONObject> list = db.query("select code from std_inner_version order by code desc");
        if (!CollectionUtil.isEmpty(list)) {
            localVersion = list.get(0).getString("code");
        }
        return localVersion;
    }
    private String getRemoteVersion(String orgCode) {
        return EsbHttp.getRemoteVersion(orgCode);
    private void getRemoteVersion() {
        try {
            if (versionMethod == null){
                versionMethod = ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.standard.getVersion");
            }
            HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
            hopClient.setAppId(sysConfig.getPlatformAppId());
            hopClient.setUrl(sysConfig.getPlatformUrl());
            hopClient.setMethod(versionMethod);
            if (sysConfig.isEmptyOrgCode()) {
                LogUtil.fatal("当前机构代码为空,版本无法更新,请确认!");
                return;
            }
            hopClient.setParam("org_code", sysConfig.getOrgCode());
            Response response = hopClient.get();
            if (response == null || response.statusCode != 200) {
                LogUtil.fatal("获取健康云平台标准版本号失败,网络错误或者服务器不可用.");
                return;
            }
            ObjectMapper mapper = new ObjectMapper();
            JsonNode rootNode = mapper.readValue(response.body, JsonNode.class);
            String code = rootNode.path("code").asText();
            if (!code.equals("0")) {
                LogUtil.fatal("获取健康云平台标准版本号失败," + code);
                return;
            }
            remoteVersion = rootNode.path("result").path("version").asText();
        } catch (IOException e) {
            LogUtil.fatal("获取远程版本号异常");
            LogUtil.error(e);
        }
    }
    /**
@ -123,9 +171,9 @@ public class StandardManager {
     *
     * @return boolean
     */
    private boolean versionUpdate(String encryptPwd) {
    private boolean versionUpdate() {
        boolean result;
        result = unpack(encryptPwd);
        result = unpack();
        if (!result) {
            LogUtil.fatal("标准包解压错误.");
            return false;
@ -136,54 +184,73 @@ public class StandardManager {
            return false;
        }
        result = new StandardService().genData(zipFiles);
        result = genData();
        if (!result) {
            LogUtil.fatal("生成标准数据失败.");
            return false;
        }
        updateVersion();
        return true;
    }
    private String download(String remoteVersion, String orgCode) {
        Response response = EsbHttp.download(remoteVersion, orgCode);
        try {
            if (response != null && response.getStatusCode() == 200) {
                JSONObject re = new JSONObject(response.getBody());
    private void updateVersion() {
        if (remoteVersion != null) {
            localVersion = new String(remoteVersion);
        }
    }
                if (re.has("password")&&re.has("url")) {
                    String encryptPwd = re.getString("password");
                    String zipContent = re.getString("url");
                    String downloadFilePath = SysConfig.getInstance().getTempFile() + "/" + Constants.STANDARD_ZIP;
                    //boolean writeFile = FileUtil.writeFile(downloadFilePath, zipContent, "UTF-8");
                    HttpClientUtil.downLoadFile(downloadFilePath,zipContent,"","");
    private boolean download() {
        try {
            downMethod= ConfigureUtil.getProValue(ConfigureUtil.CRAWLER_PROPERTIES, "ha.url.standard.allSchemaMappingPlan");
            HOPClient hopClient = new HOPClient(HOPClient.HTTPS);
            hopClient.setAppId(sysConfig.getPlatformAppId());
            hopClient.setUrl(sysConfig.getPlatformUrl());
            hopClient.setMethod(downMethod);
            hopClient.setParam("versionCode", remoteVersion);
            hopClient.setParam("user_name", sysConfig.getPlatformUserName());
            hopClient.setParam("orgcode", sysConfig.getOrgCode());
//            if (!bFull) {
//                hopClient.setParam("current_version", localVersion);
//            }
            Response response = hopClient.get();
            if (response == null || response.statusCode != 200) {
                LogUtil.fatal("下载标准包失败,网络错误或者服务器不可用.");
                return false;
        }
                    return encryptPwd;
                }
                else{
                    LogUtil.fatal("获取标准包失败");
                    return null;
                }
            ObjectMapper mapper = new ObjectMapper();
            JsonNode rootNode = mapper.readValue(response.body, JsonNode.class);
            String code = rootNode.path("code").asText();
            if (!code.equals("0")) {
                LogUtil.fatal("下载标准包失败," + code);
                return false;
            }
            else{
                LogUtil.fatal("下载标准包失败,网络错误或者服务器不可用.");
                return null;
            encryptPwd = rootNode.path("result").path("cryptograph").asText();
            String zipContent = rootNode.path("result").get("zipfile").asText();
            byte[] decode = Base64.decode(zipContent);
            downloadFilePath = sysConfig.getTempFile() + "/" + Constants.STANDARD_ZIP;
            boolean writeFile = FileUtil.writeFile(downloadFilePath, decode, "UTF-8");
            if (!writeFile) {
                LogUtil.fatal("下载标准包失败,生成本地临时文件错误.");
                return false;
            }
            return true;
        } catch (Exception e) {
            LogUtil.fatal("下载标准包异常:");
            LogUtil.error(e);
        }
        return null;
        return false;
    }
    private boolean unpack(String encryptPwd) {
    private boolean unpack() {
        try {
            String publicKey = sysConfig.getPublicKey();
            if(publicKey==null ||publicKey.length()==0)
            {
                publicKey = EsbHttp.getPublicKey();
                sysConfig.setPublicKey(publicKey);
            }
            Key key = RSA.genPublicKey(publicKey);
            Key key = RSA.genPublicKey(sysConfig.getPublicKey());
            if (key == null) {
                LogUtil.fatal("解压文件错误,获取公钥错误.");
                return false;
@ -218,6 +285,42 @@ public class StandardManager {
        return true;
    }
    private boolean genData() {
        List<String> sqlList = new ArrayList<>();
        List<String> fileNameList = new ArrayList<>();
        List<String> deleteDataList = new ArrayList<>();
        for (File file : zipFiles) {
            if (!file.getName().contains("_cda")) {
                if (file.getName().contains("org_")||file.getName().contains("adapter_")
                        ||file.getName().contains("std_")) {
                    fileNameList.add(StringUtil.substring(file.getName(), 0, file.getName().indexOf(Constants.DOT)));
                }
                if (!file.getParentFile().getName().equals(Constants.CDA_FILE)) {
                    createData(file, sqlList);
                }
            }
        }
        SqlCreate sqlCreate = new SqlCreate();
        for (String fileName : fileNameList) {
            sqlCreate.setTableName(fileName);
            deleteDataList.add(sqlCreate.deleteData());
        }
        String[] deleteArray = new String[deleteDataList.size()];
        deleteDataList.toArray(deleteArray);
        String[] sqlArray = new String[sqlList.size()];
        sqlList.toArray(sqlArray);
        try {
            db.executeBatch(deleteArray);
            db = new DBHelper();
            db.executeBatch(sqlArray);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    private void createData(File file, List<String> sqlList) {
        try {
            SAXReader reader = new SAXReader();

+ 0 - 189
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/standard/StandardService.java

@ -1,189 +0,0 @@
package com.yihu.ehr.service.standard;
import com.yihu.ehr.common.constants.Constants;
import com.yihu.ehr.dbhelper.jdbc.DBConfig;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.CollectionUtil;
import com.yihu.ehr.util.operator.SqlCreate;
import com.yihu.ehr.util.operator.StringUtil;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.json.JSONObject;
import java.io.File;
import java.sql.Connection;
import java.util.*;
/**
 * 线程取数据,不走连接池
 */
public class StandardService {
    private DBHelper db = new DBHelper();
    /**
     * 获取当前自版本号
     */
    public synchronized String getCurrentVersion() {
        try {
            String localVersion = "";
            List<JSONObject> list = db.query("select code from std_inner_version order by code desc");
            if (!CollectionUtil.isEmpty(list)) {
                localVersion = list.get(0).getString("code");
            }
            return localVersion;
        }
        catch (Exception e)
        {
            LogUtil.error(e);
            return "";
        }
    }
    /**
     * 读取标准数据
     */
    public synchronized boolean genData(File[] zipFiles) {
        List<String> sqlList = new ArrayList<>();
        List<String> fileNameList = new ArrayList<>();
        List<String> deleteDataList = new ArrayList<>();
        for (File file : zipFiles) {
            if (!file.getName().contains("_cda")) {
                if (file.getName().contains("org_")||file.getName().contains("adapter_")
                        ||file.getName().contains("std_")) {
                    fileNameList.add(StringUtil.substring(file.getName(), 0, file.getName().indexOf(Constants.DOT)));
                }
                if (!file.getParentFile().getName().equals(Constants.CDA_FILE)) {
                    createData(file, sqlList);
                }
            }
        }
        SqlCreate sqlCreate = new SqlCreate();
        for (String fileName : fileNameList) {
            sqlCreate.setTableName(fileName);
            deleteDataList.add(sqlCreate.deleteData());
        }
        String[] deleteArray = new String[deleteDataList.size()];
        deleteDataList.toArray(deleteArray);
        String[] sqlArray = new String[sqlList.size()];
        sqlList.toArray(sqlArray);
        try {
            db.executeBatch(deleteArray);
            db = new DBHelper();
            db.executeBatch(sqlArray);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    private void createData(File file, List<String> sqlList) {
        try {
            SAXReader reader = new SAXReader();
            Document doc = reader.read(file);
            Element root = doc.getRootElement();
            String tableName = root.attributeValue("name");
            if (tableName == null) {
                throw new Exception("错误的标准格式,无表名信息.");
            }
            Element metadata = root.element("metadata");
            if (metadata == null) {
                throw new Exception("错误的标准格式,无表字段信息.");
            }
            HashMap<String, String> colMap = getColMetaData(metadata);
            for (Iterator rowIterator = root.elementIterator("row"); rowIterator.hasNext();) {
                SqlCreate sqlCreate = new SqlCreate();
                sqlCreate.setTableName(tableName);
                Element rowElement = (Element) rowIterator.next();
                createDataSql(rowElement, colMap, sqlList, sqlCreate);
            }
        } catch (Exception e) {
            LogUtil.fatal("生成标准表异常:");
            LogUtil.error(e);
        }
    }
    private HashMap<String, String> getColMetaData(Element rowElem) {
        HashMap<String, String> hashMap = new HashMap<>();
        for (Iterator colIterator = rowElem.elementIterator(); colIterator.hasNext(); ) {
            Element colElement = (Element) colIterator.next();
            String name = colElement.attributeValue("name");
            String type = colElement.attributeValue("type");
            hashMap.put(name, type);
        }
        return hashMap;
    }
    private void createDataSql(Element rowElement, HashMap<String, String> colMap, List<String> sqlList, SqlCreate sqlCreate) {
        if (rowElement == null) {
            return;
        }
        Map<String, String> keyValueMap = new HashMap<>();
        List<String> itemList = new ArrayList<>();
        List<String> itemValueList = new ArrayList<>();
        for (Iterator colIterator = rowElement.elementIterator(); colIterator.hasNext(); ) {
            Element colElement = (Element) colIterator.next();
            if (colElement.getText().equals("")) {
                continue;
            }
            String key = colElement.getName();
            itemList.add(key);
            String type = colMap.get(key);
            if (type == null) {
                LogUtil.fatal("createDataSql无效的类型.");
            }
            String value;
            switch (type) {
                case "N":
                    value = colElement.getText();
                    break;
                case "S":
                    value = "'" + colElement.getText().replace("'","''") + "'";
                    break;
                case "D":
                    value = "'" + colElement.getText() + "'";
                    break;
                default:
                    value = colElement.getText();
            }
            itemValueList.add(value);
            keyValueMap.put(key, value);
            if (key.equals(Constants.TABLE_KEY)) {
                sqlCreate.setTableKey(value);
            }
        }
        sqlCreate.setItemList(itemList);
        sqlCreate.setItemValueList(itemValueList);
        sqlCreate.setKeyValueMap(keyValueMap);
        if (Constants.ADD_TYPE.equals(rowElement.attributeValue("type"))) {
            sqlList.add(sqlCreate.insertData());
        } else if (Constants.UPDATE_TYPE.equals(rowElement.attributeValue("type"))) {
            sqlList.add(sqlCreate.updateDataByTableKey());
            if (sqlCreate.isToAdapter() && sqlCreate.isCodeOrValue()) {
                sqlList.add(sqlCreate.updateAdapterData());
            }
        } else if (Constants.DELETE_TYPE.equals(rowElement.attributeValue("type"))) {
            sqlList.add(sqlCreate.deleteDataByTableKey());
            if (sqlCreate.isToAdapter()) {
                sqlList.add(sqlCreate.deleteAdapterData());
            }
            if (sqlCreate.isToAdapterDataset()) {
                sqlList.add(sqlCreate.deleteAdapterOriginData());
            }
        }
    }
}

+ 5 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/CrawlerSupplyThread.java

@ -12,7 +12,11 @@ public class CrawlerSupplyThread implements Runnable {
        while (ThreadManage.crawlerSupplyIsRunning) {
            try {
                LogUtil.info("补采线程开始");
                CrawlerManager.getInstance().dataCrawlerSupply();
                if (StandardManager.getInstance().isDataInit()) {
                    CrawlerManager.getInstance().dataCrawlerSupply();
                } else {
                    LogUtil.info("标准数据还未初始化,请确认!");
                }
                LogUtil.info("补采线程结束");
                sleep();
            } catch (InterruptedException e) {

+ 6 - 4
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/CrawlerThread.java

@ -1,7 +1,6 @@
package com.yihu.ehr.service.thread;
import com.yihu.ehr.common.config.ThreadConfig;
import com.yihu.ehr.dbhelper.jdbc.DBConfig;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.service.crawler.CrawlerManager;
import com.yihu.ehr.service.standard.StandardManager;
@ -9,14 +8,16 @@ import com.yihu.ehr.util.log.LogUtil;
public class CrawlerThread implements Runnable {
    DBHelper db = new DBHelper(Thread.currentThread().getName(), DBConfig.get("defaultUri"));
    @Override
    public void run() {
        while (ThreadManage.crawlerIsRunning) {
            try {
                LogUtil.info("采集线程开始");
                CrawlerManager.getInstance().dataCrawlerFrequency();
                if (StandardManager.getInstance().isDataInit()) {
                    CrawlerManager.getInstance().dataCrawlerFrequency();
                } else {
                    LogUtil.info("标准数据还未初始化,请确认!");
                }
                LogUtil.info("采集线程结束");
                sleep();
            } catch (InterruptedException e) {
@ -39,6 +40,7 @@ public class CrawlerThread implements Runnable {
    private void sleep() throws Exception {
        if (ThreadConfig.CRAWLER_THREAD_SLEEP_TIME == 0) {
            DBHelper db = new DBHelper();
            Object obj = db.scalar("select param_value from system_param where param_key='INTERVAL'");
            if(obj!=null) {
                ThreadConfig.CRAWLER_THREAD_SLEEP_TIME = Integer.parseInt(obj.toString());

+ 0 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/service/thread/StandardUpdateThread.java

@ -2,7 +2,6 @@ package com.yihu.ehr.service.thread;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.common.config.ThreadConfig;
import com.yihu.ehr.dbhelper.jdbc.DBConfig;
import com.yihu.ehr.dbhelper.jdbc.DBHelper;
import com.yihu.ehr.service.standard.StandardManager;
import com.yihu.ehr.util.log.LogUtil;

+ 29 - 58
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/file/FileUtil.java

@ -43,7 +43,7 @@ public class FileUtil {
        return true;
    }
    public static boolean writeFile(String filePath, InputStream fis, String encoding) throws IOException {
    public static boolean writeFile(String filePath,InputStream fis, String encoding) throws IOException {
        File file = new File(filePath);
        if (!file.getParentFile().exists()) {
            if (!file.getParentFile().mkdirs()) {
@ -87,14 +87,13 @@ public class FileUtil {
    /**
     * file转string
     *
     * @param file 文件
     * @return string类型流
     */
    public static String convertFileToString(File file) {
        StringBuilder sb = new StringBuilder();
        if (file.isFile() && file.exists()) {
        if(file.isFile()&&file.exists()) {
            InputStreamReader read = null;
            try {
                read = new InputStreamReader(new FileInputStream(file), "UTF-8");
@ -123,19 +122,20 @@ public class FileUtil {
    }
    /**
     * 清空文件内容
     *
     * @param filePath 文件路径
     * @param content  写入内容
     * @param content 写入内容
     */
    public static void clearInfoForFile(String filePath, String content) {
        File file = new File(filePath);
    public static void clearInfoForFile(String filePath,String content) {
        File file =new File(filePath);
        try {
            if (!file.exists()) {
            if(!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter = new FileWriter(file);
            FileWriter fileWriter =new FileWriter(file);
            fileWriter.write(content);
            fileWriter.flush();
            fileWriter.close();
@ -145,34 +145,36 @@ public class FileUtil {
    }
    /**
     * 记录文件最后读取的位置
     *
     * @param readPath 被读取文件路径
     * @param savePath 保存被读取文件的最后位置 的文件路径
     * @param readPath  被读取文件路径
     * @param savePath  保存被读取文件的最后位置 的文件路径
     */
    public static Integer saveFilePos(String readPath, String savePath) {
        boolean result = false;
        File readFile = new File(readPath);
        Integer lenth = null;
        try {
            if (readFile.exists()) {
    public static Integer  saveFilePos(String  readPath,  String  savePath)  {
        boolean result=false;
        File readFile=new File(readPath);
        Integer lenth=null;
        try  {
            if(readFile.exists()){
                InputStream inputStream = new FileInputStream(readPath);
                lenth = inputStream.available();
                clearInfoForFile(savePath, "");//清空内容
                writeFile(savePath, lenth.toString(), "UTF-8");//重新写入标识
                clearInfoForFile(savePath,"");//清空内容
                writeFile(savePath,lenth.toString(),"UTF-8");//重新写入标识
            }
        } catch (Exception e) {
        }
        catch  (Exception  e)  {
            e.printStackTrace();
        }
        return lenth;
    }
    public static Integer getFileSize(String path) {
        Integer size = 0;
        InputStream inputStream = null;
        File file = new File(path);
        if (file.exists()) {
        Integer size=0;
        InputStream inputStream=null;
        File file=new File(path);
        if (file.exists()){
            try {
                inputStream = new FileInputStream(path);
                size = inputStream.available();
@ -180,13 +182,12 @@ public class FileUtil {
                e.printStackTrace();
            }
        }
        return size;
       return size;
    }
    /**
     * 读取文本文件内容
     *
     * @param file 文件路径
     * @param file  文件路径
     * @return
     */
    public static String readFileText(File file) {
@ -214,34 +215,4 @@ public class FileUtil {
        return stringBuilder.toString();
    }
    public static File writeFile(String filePathAndName, String fileContent) {
        File f = new File(filePathAndName);
        OutputStreamWriter write =null;
        BufferedWriter writer=null;
        try {
            if (!f.exists()) {
                f.createNewFile();
            }
             write = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
             writer = new BufferedWriter(write);
             writer.write(fileContent);
        } catch (Exception e) {
            System.out.println("写文件内容操作出错");
            e.printStackTrace();
        }finally {
            try {
                if(writer!=null){
                    writer.close();
                }
                if(write!=null){
                    write.close();
                }
            }catch (Exception e){
                e.printStackTrace();;
            }
        }
        return f;
    }
}

+ 58 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpClient.java

@ -0,0 +1,58 @@
package com.yihu.ehr.util.http;
import org.apache.http.Header;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.util.List;
import java.util.Map;
/**
 * @author Air
 * @version 1.0
 * @created 2015.08.16 9:10
 */
public class HAHttpClient implements IHAHttpClient {
    private HAHttpClientImpl haHttpClientImpl;
    private RequestConfig requestConfig;
    private HttpClientContext context;
    public HAHttpClient(RequestConfig requestConfig, HttpClientContext context) {
        haHttpClientImpl = new HAHttpClientImpl(requestConfig, context);
    }
    @Override
    public Response get(String url) {
        return get(url,null);
    }
    @Override
    public Response get(String url,Map<String,String> header) {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        return haHttpClientImpl.get(httpClient, url,header);
    }
    public Response put(String url) {
        return put(url, null);
    }
    public Response put(String url,Map<String,String> header) {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        return haHttpClientImpl.put(httpClient, url, header);
    }
    @Override
    public Response postForm(String url, List<NameValuePair> formParams) {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        return haHttpClientImpl.postForm(httpClient, url, formParams);
    }
    @Override
    public Response postFile(String url, String filePath) {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        return haHttpClientImpl.postFile(httpClient, url, filePath);
    }
}

+ 172 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpClientImpl.java

@ -0,0 +1,172 @@
package com.yihu.ehr.util.http;
import com.yihu.ehr.util.log.LogUtil;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
 * @author Air
 * @version 1.0
 * @created 2015.08.16 10:20
 */
public class HAHttpClientImpl {
    private RequestConfig requestConfig;
    private HttpClientContext context;
    public HAHttpClientImpl(RequestConfig requestConfig, HttpClientContext context) {
        this.requestConfig = requestConfig;
        this.context = context;
    }
    public Response postForm(CloseableHttpClient httpClient, String url, List<NameValuePair> formParams) {
        UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
        HttpPost httpPost = new HttpPost(url);
        httpPost.setEntity(postEntity);
        httpPost.setConfig(requestConfig);
        CloseableHttpResponse response = null;
        HttpEntity entity = null;
        try {
            response = httpClient.execute(httpPost, context);
            entity = response.getEntity();
            Response res = new Response(response.getStatusLine().getStatusCode(), EntityUtils.toString(entity));
            return res;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            close(httpClient, entity);
        }
        return null;
    }
    public Response postFile(CloseableHttpClient httpClient, String url, String filePath) {
        File file = new File(filePath);
        HttpPost httpPost = new HttpPost(url);
        FileBody fileBody = new FileBody(file);
        MultipartEntity fileEntity = new MultipartEntity();
        fileEntity.addPart("file", fileBody);
        httpPost.setEntity(fileEntity);
        httpPost.setConfig(requestConfig);
        CloseableHttpResponse response = null;
        HttpEntity entity = null;
        try {
            response = httpClient.execute(httpPost, context);
            entity = response.getEntity();
            Response res = new Response(response.getStatusLine().getStatusCode(), EntityUtils.toString(entity));
            return res;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            close(httpClient, entity);
        }
        return null;
    }
    public Response get(CloseableHttpClient httpClient, String url) {
        return get(httpClient,url,null);
    }
    public Response get(CloseableHttpClient httpClient, String url,Map<String,String> header) {
        HttpGet httpget = new HttpGet(url);
        httpget.setConfig(requestConfig);
        CloseableHttpResponse response;
        HttpEntity entity = null;
        if(header!=null)
        {
            for (String key : header.keySet()) {
                httpget.addHeader(key, header.get(key));
            }
        }
        try {
            response = httpClient.execute(httpget, context);
            entity = response.getEntity();
            Response res = new Response(response.getStatusLine().getStatusCode(), EntityUtils.toString(entity));
            return res;
        } catch (IOException e) {
            LogUtil.error(e);
        } finally {
            close(httpClient, entity);
        }
        return null;
    }
    public Response put(CloseableHttpClient httpClient, String url) {
        return put(httpClient, url, null);
    }
    public Response put(CloseableHttpClient httpClient, String url,Map<String,String> header) {
        HttpPut http = new HttpPut(url);
        http.setConfig(requestConfig);
        CloseableHttpResponse response;
        HttpEntity entity = null;
        if(header!=null)
        {
            for (String key : header.keySet()) {
                http.addHeader(key, header.get(key));
            }
        }
        try {
            response = httpClient.execute(http, context);
            entity = response.getEntity();
            Response res = new Response(response.getStatusLine().getStatusCode(), EntityUtils.toString(entity));
            return res;
        } catch (IOException e) {
            LogUtil.error(e);
        } finally {
            close(httpClient, entity);
        }
        return null;
    }
    private void close(CloseableHttpClient httpClient, HttpEntity entity) {
        try {
            EntityUtils.consume(entity);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            httpClient.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

+ 71 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HAHttpsClient.java

@ -0,0 +1,71 @@
package com.yihu.ehr.util.http;
import org.apache.http.Header;
import org.apache.http.NameValuePair;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.util.List;
import java.util.Map;
/**
 * @author Air
 * @version 1.0
 * @created 2015.07.02 15:37
 */
public class HAHttpsClient implements IHAHttpClient {
    private HAHttpClientImpl haHttpClientImpl;
    private SSLConnectionSocketFactory sslConnectionSocketFactory;
    private RequestConfig requestConfig;
    private HttpClientContext context;
    public HAHttpsClient(SSLConnectionSocketFactory sslConnectionSocketFactory, RequestConfig requestConfig, HttpClientContext context) {
        haHttpClientImpl = new HAHttpClientImpl(requestConfig, context);
        this.sslConnectionSocketFactory = sslConnectionSocketFactory;
    }
    public Response get(String url) {
        return get(url, null);
    }
    public Response get(String url,Map<String,String> header) {
        CloseableHttpClient httpClient = HttpClients.custom()
                .setSSLSocketFactory(this.sslConnectionSocketFactory)
                .build();
        return haHttpClientImpl.get(httpClient, url,header);
    }
    public Response put(String url) {
        return put(url, null);
    }
    public Response put(String url,Map<String,String> header) {
        CloseableHttpClient httpClient = HttpClients.custom()
                .setSSLSocketFactory(this.sslConnectionSocketFactory)
                .build();
        return haHttpClientImpl.put(httpClient, url, header);
    }
    public Response postForm(String url, List<NameValuePair> formParams) {
        CloseableHttpClient httpClient = HttpClients.custom()
                .setSSLSocketFactory(this.sslConnectionSocketFactory)
                .build();
        return haHttpClientImpl.postForm(httpClient, url, formParams);
    }
    public Response postFile(String url, String filePath) {
        CloseableHttpClient httpClient = HttpClients.custom()
                .setSSLSocketFactory(this.sslConnectionSocketFactory)
                .build();
        return haHttpClientImpl.postFile(httpClient, url, filePath);
    }
}

+ 241 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HOPClient.java

@ -0,0 +1,241 @@
package com.yihu.ehr.util.http;
import com.yihu.ehr.util.encrypt.MD5;
import com.yihu.ehr.util.file.FileUtil;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.StringUtil;
import org.apache.http.NameValuePair;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.BasicCredentialsProvider;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
public class HOPClient {
    static final public String HTTPS = "https";
    static final public String HTTP = "http";
    static private HttpsInitialise initialise = new HttpsInitialise();
    static private RequestConfig requestConfig;
    static private HttpClientContext context;
    private final String version = "1.0";
    private final String signMethod = "md5";
    private String method;
    private String timestamp;
    private String format;
    private String appId;
    private String accessToken;
    private String url;
    private TreeMap<String, String> paramMap;
    private IHAHttpClient ihaHttpClient;
    public HOPClient(String protocol) {
        paramMap = new TreeMap<>();
        if (protocol.equals(HTTPS)) {
            ihaHttpClient = new HAHttpsClient(initialise.getSslConnectionSocketFactory(), requestConfig, context);
        } else {
            ihaHttpClient = new HAHttpClient(requestConfig, context);
        }
    }
    public static void initHttps(String trustStorePath, String password) throws Exception {
        initialise.init(trustStorePath, password);
    }
    public static void initBasciAuth(String username, String password) throws Exception {
        requestConfig = RequestConfig.custom().
                setAuthenticationEnabled(true).build();
        context = HttpClientContext.create();
        //通过http的上下文设置账号密码
        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                new org.apache.http.auth.UsernamePasswordCredentials(username, password));
        context.setCredentialsProvider(credsProvider);
    }
    public void reset() {
        paramMap.clear();
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public void setFormat(String format) {
        this.format = format;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public void setParam(String key, String value) {
        paramMap.put(key, value);
    }
    public Response get() {
        String completeUrl = completeUrl();
        if (completeUrl == null) {
            return null;
        }
        return ihaHttpClient.get(completeUrl);
    }
    public Response basicPut(String user,String password)
    {
        String completeUrl = completeUrl();
        if (completeUrl == null) {
            return null;
        }
        Map<String,String> header = new HashMap<>();
        String auth  = new BASE64Encoder().encode((user+":"+password).getBytes());
        header.put("Authorization","Basic "+auth);
        return ihaHttpClient.put(completeUrl,header);
    }
    public boolean downLoad(String path) {
        String completeUrl = completeUrl();
        if (completeUrl == null) {
            return false;
        }
        Response response = ihaHttpClient.get(completeUrl);
        if (response == null || response.statusCode != 200) {
            return false;
        }
        try {
            boolean result = FileUtil.writeFile(path, response.body, "UTF-8");
            if (!result) {
                LogUtil.fatal("下载文件失败.");
            }
            return result;
        } catch (IOException e) {
            e.printStackTrace();
            LogUtil.error("下载文件失败:");
            LogUtil.error(e);
        }
        return false;
    }
    public Response postForm(List<NameValuePair> formParams) {
        String completeUrl = completeUrl();
        if (completeUrl == null) {
            return null;
        }
        return ihaHttpClient.postForm(completeUrl, formParams);
    }
    public Response postFile(String filePath) {
        String completeUrl = completeUrl();
        try {
            Response response = ihaHttpClient.postFile(completeUrl, filePath);
            return response;
        } catch (Exception e) {
            LogUtil.fatal(completeUrl);
            return null;
        }
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    private String completeUrl() {
        try {
//            addParam("method", method, true);
            addParam("format", format, false);
            addParam("app_id", appId, true);
            addParam("timestamp", getTimestamp(), true);
            addParam("v", version, true);
            addParam("sign_method", signMethod, true);
            addParam("access_token", accessToken, false);
            addParam("sign", signParam(), true);
            String completeUrl = url +method+ genParam();
            LogUtil.trace(completeUrl);
            return completeUrl;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    private void addParam(String paramName, String paramValue, boolean bMust) throws Exception {
        if (StringUtil.isEmpty(paramValue)) {
            if (bMust) {
                throw new Exception(paramName + "参数不能为空.");
            } else {
                return;
            }
        }
        String encodeValue = URLEncoder.encode(paramValue, "UTF-8");
        paramMap.put(paramName, encodeValue);
    }
    private String signParam() {
        Iterator<Map.Entry<String, String>> iterator = paramMap.entrySet().iterator();
        StringBuilder builder = new StringBuilder();
        while (iterator.hasNext()) {
            Map.Entry<String, String> next = iterator.next();
            String key = next.getKey();
            String value = next.getValue();
            builder.append(key);
            builder.append(value);
        }
        try {
            return MD5.hash(builder.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    private String genParam() throws Exception {
        Iterator<Map.Entry<String, String>> iterator = paramMap.entrySet().iterator();
        StringBuilder builder = new StringBuilder();
        while (iterator.hasNext()) {
            Map.Entry<String, String> next = iterator.next();
            String key = next.getKey();
            String value = next.getValue();
            if (value == null) {
                throw new Exception("参数错误:参数" + key + "值为空.");
            }
            if (builder.length() == 0) {
                builder.append("?");
            } else {
                builder.append("&");
            }
            builder.append(key);
            builder.append("=");
            builder.append(URLEncoder.encode(value, "UTF-8"));
        }
        return builder.toString();
    }
    private String getTimestamp() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        timestamp = format.format(new Date());
        return timestamp;
    }
}

+ 1 - 1
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HopHostnameVerifier.java

@ -1,4 +1,4 @@
package com.yihu.ehr.util.httpclient;
package com.yihu.ehr.util.http;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;

+ 408 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HttpClientUtil.java

@ -0,0 +1,408 @@
package com.yihu.ehr.util.http;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * HTTP 请求工具类
 *
 * @author : cwd
 * @version : 1.0.0
 * @date : 2016/1/14
 * @see : TODO
 */
public class HttpClientUtil {
    /**
     * 发送 GET 请求(HTTP),不带输入数据 不加密
     *
     * @param url
     * @return
     */
    public static String doGet(String url) throws Exception {
        return doGet(url, new HashMap<String, Object>(), "", "");
    }
    /**
     * 发送 GET 请求(HTTP),不带输入数据 不加密
     *
     * @param url
     * @return
     */
    public static String doGet(String url, Map<String, Object> params) throws Exception {
        return doGet(url, params, "", "");
    }
    /**
     * 发送 GET 请求(HTTP),不带输入数据 加密
     *
     * @param url
     * @return
     */
    public static String doGet(String url, String username, String password) throws Exception {
        return doGet(url, new HashMap<String, Object>(), username, password);
    }
    /**
     * httpClient的get请求方式
     *
     * @return
     * @throws Exception
     */
    public static String doGet(String url, Map<String, Object> params, String username, String password)
            throws Exception {
        String responString = "";
        CloseableHttpResponse response1 = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        //设置请求信息
        try {
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //配置参数
            for (String key : params.keySet()) {
                jsonParams.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
            }
            HttpGet httpget = new HttpGet(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
            httpget.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response1 = httpclient.execute(httpget, context);
            } else {
                response1 = httpclient.execute(httpget);
            }
            HttpEntity entity1 = response1.getEntity();
            responString = EntityUtils.toString(entity1, "UTF-8");
        } finally {
            response1.close();
            httpclient.close();
        }
        return responString;
    }
    /**
     * httpClient的post请求方式
     *
     * @param url
     * @param params
     * @param username
     * @param password
     * @return
     * @throws Exception
     */
    public static String doPost(String url, Map<String, Object> params, String username, String password) throws Exception {
        String responString = "";
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                formparams.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));
            }
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
            httpPost.setEntity(entity);
            httpPost.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpPost, context);
            } else {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            //流转字符串
            responString = EntityUtils.toString(httpEntity);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            response.close();
            httpclient.close();
        }
        return responString;
    }
    /**
     * httpClient的put请求方式
     *
     * @param url
     * @param params
     * @param username
     * @param password
     * @return
     * @throws Exception
     */
    public static String doPut(String url, Map<String, Object> params, String username, String password) throws Exception {
        String responString = "";
        CloseableHttpResponse response1 = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //配置参数
            for (String key : params.keySet()) {
                jsonParams.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
            }
            HttpPut httpPut = new HttpPut(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
            httpPut.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response1 = httpclient.execute(httpPut, context);
            } else {
                response1 = httpclient.execute(httpPut);
            }
            HttpEntity entity1 = response1.getEntity();
            responString = EntityUtils.toString(entity1, "UTF-8");
        } finally {
            response1.close();
            httpclient.close();
        }
        return responString;
    }
    /**
     * httpClient的delete请求方式
     *
     * @param url
     * @param params
     * @param username
     * @param password
     * @return
     * @throws Exception
     */
    public static String doDelete(String url, Map<String, Object> params, String username, String password) throws Exception {
        String responString = "";
        CloseableHttpResponse response1 = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //配置参数
            for (String key : params.keySet()) {
                jsonParams.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
            }
            HttpDelete httpget = new HttpDelete(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
            httpget.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response1 = httpclient.execute(httpget, context);
            } else {
                response1 = httpclient.execute(httpget);
            }
            HttpEntity entity1 = response1.getEntity();
            responString = EntityUtils.toString(entity1, "UTF-8");
        } finally {
            response1.close();
            httpclient.close();
        }
        return responString;
    }
    /**
     * 文件上传
     *
     * @param file
     * @param url
     * @param username
     * @param password
     * @return
     * @throws IOException
     */
    public static String sendFile(File file, String url, String username, String password) throws IOException {
        String responString = "";
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            httpPost.setConfig(requestConfig);
            FileBody bin = new FileBody(file);
            MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create();
            reqEntity.addPart("file", bin);
            httpPost.setEntity(reqEntity.build());
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpPost, context);
            } else {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            //流转字符串
            responString = EntityUtils.toString(httpEntity);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            response.close();
            httpclient.close();
        }
        return responString;
    }
    /**
     * 文件下载
     *
     * @param filePath
     * @param url
     * @param username
     * @param password
     * @return
     * @throws Exception
     */
    public static File downFile(String filePath, Map<String, Object> params, String url, String username, String password) throws Exception {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                formparams.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));
            }
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
            httpPost.setEntity(entity);
            httpPost.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpPost, context);
            } else {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            InputStream is = httpEntity.getContent();
            file = new File(filePath);
            file.getParentFile().mkdirs();
            FileOutputStream fileout = new FileOutputStream(file);
            /**
             * 根据实际运行效果 设置缓冲区大小
             */
            byte[] buffer = new byte[1024];
            int ch = 0;
            while ((ch = is.read(buffer)) != -1) {
                fileout.write(buffer, 0, ch);
            }
            is.close();
            fileout.flush();
            fileout.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            response.close();
            httpclient.close();
        }
        return file;
    }
    public static void main(String[] args) throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
//        params.put("standard", "{\n" +
//                "    \"id\": 4,\n" +
//                "    \"name\": \"电子健康档案标准bbb\",\n" +
//                "    \"code\": \"YY20160114\",\n" +
//                "    \"publisher\": \"健康之路2\",\n" +
//                "    \"publisherOrgCode\": \"jkzl\",\n" +
//                "    \"summary\": \"string\",\n" +
//                "    \"refStandard\": \"WS2012\",\n" +
//                "    \"refStandardVersion\": \"V1.0\",\n" +
//                "    \"versionStatus\": 0\n" +
//                "}");
        // params.put("versionId", "5694696eb80d");
        //  params.put("publisher", "lfq");
        //   System.out.println(HttpClientUtil.doPost("http://192.168.131.17:6020/api/v1.0/standard_center/version/publish", params, "user", "standard"));
        //文件上传
        //File file = new File("F:/111.txt");
        // HttpClientUtil.sendFile(file, "http://192.168.131.6:8890/api/v1.0/resource/upload", "user", "standard");
        //文件下载
        params.put("field", "[{\"key\":\"name\",\"value\":\"资源名称\"},{\"key\":\"code\",\"value\":\"资源代码\"},{\"key\":\"type\",\"value\":\"资源类型\"},{\"key\":\"category\",\"value\":\"资源类别\"}]");
        params.put("name", "授权资源清单");
        params.put("id", "aaaaaaaa1");
        params.put("queryParams", "[]");
        HttpClientUtil.downFile("E:/aaa.xls", params, "http://192.168.131.6:8080/resource/exportAllExcel", "", "");
    }
}

+ 56 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/HttpsInitialise.java

@ -0,0 +1,56 @@
package com.yihu.ehr.util.http;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.ssl.SSLContexts;
import javax.net.ssl.SSLContext;
import java.io.File;
/**
 * Https相关环境初始化
 *
 * @author Air
 * @version 1.0
 * @created 2015.07.07 9:21
 */
public class HttpsInitialise {
    private static volatile HttpsInitialise instance = null;
    private SSLContext sslcontext;
    private SSLConnectionSocketFactory sslConnectionSocketFactory;
    public HttpsInitialise() {
    }
    public void finalize() throws Throwable {
    }
    /**
     * 初始化SSLConnectionSocketFactory.
     *
     * @param password       密码
     * @param trustStorePath 信任库路径
     * @throws Exception
     */
    public void init(String trustStorePath, String password) throws Exception {
        sslcontext = SSLContexts.custom()
                .loadTrustMaterial(new File(trustStorePath), password.toCharArray(),
                        new TrustSelfSignedStrategy())
                .build();
        // Allow TLSv1 protocol only
        sslConnectionSocketFactory = new SSLConnectionSocketFactory(
                sslcontext,
                new String[]{"TLSv1"},
                null,
                new HopHostnameVerifier());
    }
    public SSLConnectionSocketFactory getSslConnectionSocketFactory() {
        return sslConnectionSocketFactory;
    }
}

+ 20 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/IHAHttpClient.java

@ -0,0 +1,20 @@
package com.yihu.ehr.util.http;
import org.apache.http.NameValuePair;
import java.util.List;
import java.util.Map;
/**
 * @author Air
 * @version 1.0
 * @created 2015.08.16 9:22
 */
public interface IHAHttpClient {
    Response get(String url);
    Response get(String url,Map<String,String> header);
    Response put(String url);
    Response put(String url,Map<String,String> header);
    Response postForm(String url, List<NameValuePair> formParams);
    Response postFile(String url, String filePath);
}

+ 20 - 0
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/http/Response.java

@ -0,0 +1,20 @@
package com.yihu.ehr.util.http;
/**
 * @author Air
 * @version 1.0
 * @created 2015.07.02 14:43
 */
public class Response {
    public Response(int statusCode, String body) {
        this.statusCode = statusCode;
        this.body = body;
    }
    public final int statusCode;// e.g. 200
    public final String body;
//    public final String status; // e.g. "200 OK"
//    public final String proto; // e.g. "HTTP/1.0"
//    public final int protoMajor;     // e.g. 1
//    public final int protoMinor;    // e.g. 0
}

+ 37 - 271
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/EsbHttp.java

@ -1,27 +1,12 @@
package com.yihu.ehr.util.httpclient;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.common.config.SysConfig;
import com.yihu.ehr.common.constants.Constants;
import com.yihu.ehr.model.Patient;
import com.yihu.ehr.service.intf.ISystemManager;
import com.yihu.ehr.util.encrypt.MD5;
import com.yihu.ehr.util.log.LogUtil;
import com.yihu.ehr.util.operator.ConfigureUtil;
import com.yihu.ehr.util.operator.StringUtil;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import sun.misc.BASE64Encoder;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -37,7 +22,7 @@ public class EsbHttp {
     * 用户登录验证
     */
    public static Response loginAction(String user,String password) throws Exception{
        String loginAction = HttpHelper.defaultHttpUrl+"/authorizations/users/" + user;
        String loginAction = HttpHelper.defaultHttpUrl+"/api/v1.0/authorizations/users/" + user;
        Map<String,Object> header = new HashMap<>();
        String auth  = new BASE64Encoder().encode((user+":"+password).getBytes());
        header.put("Authorization","Basic "+auth);
@ -49,7 +34,7 @@ public class EsbHttp {
    * */
    public static Response getUserInfo(String user,String token)
    {
        String url = HttpHelper.defaultHttpUrl+"/users/" + user;
        String url = HttpHelper.defaultHttpUrl+"/api/v1.0/users/" + user;
        Map<String,Object> params = new HashMap<>();
        params.put("token",token);
        params.put("user",user);
@ -58,13 +43,14 @@ public class EsbHttp {
    /***************************** 应用接口 *********************************************/
    /**
     * 获取本机指纹
     * @return
     */
    private static String fingerprint;
    private static String GetFingerprint(){
        try {
            return system.getSystemParam("FINGER_PRINT");
            if (fingerprint == null || fingerprint.length() == 0) {
                fingerprint = system.getSystemParam("FINGER_PRINT");
            }
            return fingerprint;
        }
        catch (Exception e)
        {
@ -72,266 +58,46 @@ public class EsbHttp {
            return "";
        }
    }
    /**
     * 应用登录验证
     */
    public static String getToken(){
        try {
            String loginAction = HttpHelper.defaultHttpUrl + "/authorizations/clients/" + HttpHelper.clientId;
            Map<String, Object> header = new HashMap<>();
            header.put("Authorization", "Basic " + HttpHelper.clientKey);
            //本地指纹
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("info", "{\"fingerprint\": \"" + GetFingerprint() + "\"}");
            Response response = HttpHelper.put(loginAction, params, header);
            if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                JSONObject obj = new JSONObject(response.getBody());
                //判断是否成功
                if (obj.has("token")) {
                    return obj.getString("token");
                } else {
                    LogUtil.info("返回未包含token。");
                    return null;
                }
            } else {
                String msg = "获取Token失败。";
                if (response != null) {
                    msg += "(错误代码:" + response.getStatusCode() + ",错误信息:" + response.getBody() + ")";
                }
                LogUtil.info(msg);
                return null;
            }
        }
        catch (Exception ex)
    public static String getToken() throws Exception{
        String loginAction = HttpHelper.defaultHttpUrl + "/api/v1.0/authorizations/clients/" + HttpHelper.clientId;
        Map<String, Object> header = new HashMap<>();
        header.put("Authorization", "Basic " + HttpHelper.clientKey);
        //本地指纹
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("info", "{\"fingerprint\": \""+GetFingerprint()+"\"}");
        Response response = HttpHelper.put(loginAction, params, header);
        JSONObject obj = new JSONObject(response.body);
        //判断是否成功
        if(obj.has("token"))
        {
            LogUtil.info("获取Token失败," + ex.getMessage());
            return null;
            return obj.getString("token");
        }
    }
    /**
     * 修改远程补传状态
     */
    public static void changeFillMiningStatus(String remoteId,String message, String status){
        try {
            String token = getToken();
            Map<String, Object> paramMap = new HashMap<>();
            paramMap.put("id", remoteId);
            paramMap.put("status", status);
            paramMap.put("message", message);
            paramMap.put("token", token);
            String fillMiningMethod = HttpHelper.defaultHttpUrl + "/simplified-esb/changeFillMiningStatus";
            Response response = HttpHelper.post(fillMiningMethod, paramMap);
            if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                LogUtil.info("修改远程补传状态成功。");
            }
            else{
                String msg = "修改远程补传状态失败。";
                if (response != null)
                {
                    msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                }
                LogUtil.info(msg);
            }
        }
        catch (Exception ex)
        {
            LogUtil.info("修改远程补传状态失败." + ex.getMessage());
        else{
            throw new Exception("获取token失败!");
        }
    }
    /**
     * 获取公钥
     */
    public static String getPublicKey(){
    public static void changeFillMiningStatus(String remoteId,String message, String status) {
        String token;
        try {
            String token = getToken();
            if (SysConfig.getInstance().getPublicKey() != null) {
                return SysConfig.getInstance().getPublicKey();
            }
            String orgCode = SysConfig.getInstance().getOrgCode();
            Map<String, Object> paramMap = new HashMap<>();
            paramMap.put("org_code", orgCode);
            paramMap.put("token", token);
            String publicKeyMethod = HttpHelper.defaultHttpUrl + "/organizations/"+orgCode+"/key";
            Response response = HttpHelper.get(publicKeyMethod, paramMap);
            if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                JSONObject json = new JSONObject(response.getBody());
                if(json.has("publicKey"))
                {
                    String key = json.getString("publicKey");
                    SysConfig.getInstance().setPublicKey(key);
                    return key;
                }
                else{
                    LogUtil.info("获取公钥失败,返回未包含publicKey。");
                    return null;
                }
            }
            else{
                String msg = "获取公钥失败。";
                if (response != null)
                {
                    msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                }
                LogUtil.info(msg);
                return null;
            }
            token = getToken();
        } catch (Exception e) {
            LogUtil.info(e.getMessage());
            return null;
            LogUtil.error("修改远程补传状态时,获取token失败!");
            return;
        }
    }
    /**
     * 获取健康云平台标准版本号
     */
    public static String getRemoteVersion(String orgCode) {
        try {
            String token = getToken();
            String versionMethod = HttpHelper.defaultHttpUrl + "/adaptions/org_plan/version";
            Map<String, Object> params = new HashMap<>();
            params.put("org_code", orgCode);
            params.put("token", token);
            Response response = HttpHelper.get(versionMethod, params);
            if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                return response.getBody();
            }
            else{
                String msg = "获取健康云平台标准版本号失败";
                if (response != null)
                {
                    msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                }
                LogUtil.info(msg);
                return null;
            }
        } catch (Exception e) {
            LogUtil.fatal("获取远程版本号异常");
            LogUtil.error(e);
            return null;
        }
    }
    /**
     * 注册病人
     */
    public static Boolean register(Patient patient, String data, String token) {
        try {
            JSONObject json = new JSONObject(data);
            String colName = SysConfig.registerIdCardNo;
            if(json!=null && json.has("data"))
            {
                JSONObject p = (JSONObject)json.getJSONArray("data").get(0);
                if(!p.has(colName) || p.get(colName).equals(null) || p.getString(colName).length()==0)
                {
                    LogUtil.info("注册病人信息请求失败:身份证号码为空,patient_id=" + patient.getPatientId() + ", event_no=" + patient.getEventNo());
                    return false;
                }
                else{
                    String idCord = p.getString(colName);
                    String registerMethod = HttpHelper.defaultHttpUrl + "/patients/"+idCord;
                    if (StringUtil.isEmpty(data)) {
                        LogUtil.info("注册病人信息请求失败:无具体病人信息,patient_id=" + patient.getPatientId() + ", event_no=" + patient.getEventNo());
                        return false;
                    }
                    Map<String, Object> paramMap = new HashMap<>();
                    paramMap.put("demographic_id", idCord);
                    paramMap.put("json", data);
                    paramMap.put("token", token);
                    Response response = HttpHelper.post(registerMethod, paramMap);
                    if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                        LogUtil.info("注册病人信息成功。patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo());
                        return true;
                    }
                    else{
                        String msg = "注册病人信息请求失败。patient_id:" + patient.getPatientId() + ", event_no:" + patient.getEventNo();
                        if(response != null)
                        {
                            msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                        }
                        LogUtil.info(msg);
                        return false;
                    }
                }
            }
            else{
                LogUtil.info("注册病人信息请求失败:传入数据无效,patient_id=" + patient.getPatientId() + ", event_no=" + patient.getEventNo());
                return false;
            }
        }
        catch (Exception e)
        {
            LogUtil.info("注册病人信息请求失败."+e.getMessage());
            return false;
        }
    }
    /**
     * 上传病人档案
     */
    public static boolean upload(Patient patient, File file, String encryptPwd, String token) {
        try {
            String uploadMethod = HttpHelper.defaultHttpUrl + "/packages";
            String fileMd5= MD5.getMd5ByFile(file);
            Map<String, Object> paramMap = new HashMap<>();
            List<NameValuePair> formParams = new ArrayList<>();
            formParams.add(new BasicNameValuePair("md5", fileMd5));
            formParams.add(new BasicNameValuePair("package_crypto", encryptPwd));
            formParams.add(new BasicNameValuePair("org_code", SysConfig.getInstance().getOrgCode()));
            formParams.add(new BasicNameValuePair("token", token));
            Response response = HttpHelper.postFile(uploadMethod, formParams, file.getAbsolutePath());
            if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                LogUtil.info("上传病人档案成功,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
                return true;
            }
            else {
                String msg = "上传病人档案请求失败,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo();
                if (response != null)
                {
                    msg +="(错误代码:"+ response.getStatusCode() + ",错误信息:"+response.getBody()+")";
                }
                LogUtil.info(msg);
                return false;
            }
        }
        catch (Exception e) {
            LogUtil.fatal("上传病人档案异常,patient_id:" + patient.getPatientId() + ",event_no:" + patient.getEventNo());
            LogUtil.error(e);
            return false;
        }
    }
    /**
     * 下载标准包
     */
    public static Response download(String remoteVersion, String orgCode) {
        try {
            String token = getToken();
            String downLoadMethod = HttpHelper.defaultHttpUrl + "/adaptions/"+orgCode+"/source";
            Map<String, Object> params = new HashMap<>();
            params.put("version_code", remoteVersion);
            params.put("org_code", orgCode);
            params.put("token", token);
            Response response = HttpHelper.get(downLoadMethod, params);
            return response;
        } catch (Exception e) {
            LogUtil.fatal("下载标准包异常:");
            LogUtil.error(e);
            return null;
        Map<String, Object> paramMap = new HashMap<>();
        paramMap.put("id", remoteId);
        paramMap.put("status", status);
        paramMap.put("message", message);
        paramMap.put("token", token);
        String fillMiningMethod = HttpHelper.defaultHttpUrl+"/api/v1.0/simplified-esb/changeFillMiningStatus";
        Response response = HttpHelper.post(fillMiningMethod, paramMap);
        if (response == null || response.statusCode != 200) {
            LogUtil.fatal("修改远程补传状态失败,网络错误或者服务器不可用.");
        }
    }

+ 55 - 38
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HttpClientUtil.java

@ -97,6 +97,7 @@ public class HttpClientUtil {
                request.addHeader(key, header.get(key).toString());
            }
        }
        return request;
    }
    /****************************** 公用方法 *******************************************/
@ -126,50 +127,58 @@ public class HttpClientUtil {
            } else {
                response = httpclient.execute(request);
            }
            re.setStatusCode(response.getStatusLine().getStatusCode());
            re.setStatusCode(200);
            re.setBody(EntityUtils.toString(response.getEntity(), "UTF-8"));
        } catch (Exception e) {
            re.setStatusCode(201);
            re.setBody(e.getMessage());
            System.out.print(e.getMessage());
        } finally {
            close(httpclient, response);
        }
        return re;
    }
    /**
     * 发送文件
     *
     * @param url        路径
     * @param filePath   文件路径
     * @param formParams 参数
     * @return
     */
    public static Response postFile(String url,
                                    File file, List<NameValuePair> formParams,SSLConnectionSocketFactory ssl, String username, String password) {
        Response re = new Response();
        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = getCloseableHttpClient(ssl);
    public static String postFile(String url, String filePath, List<NameValuePair> formParams, String username, String password) {
        CloseableHttpClient httpClient = getCloseableHttpClient(null);
        File file = new File(filePath);
        try{
        //设置请求信息
        RequestConfig requestConfig = RequestConfig.custom().
                setAuthenticationEnabled(true).build();
        //创建httppost请求
        HttpPost httpPost = new HttpPost(url);
        ArrayList<Header> headers = new ArrayList<Header>();
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //创建httppost请求
            HttpPost httpPost = new HttpPost(url);
        httpPost.addHeader(new BasicHeader(HttpHeaders.AUTHORIZATION, "Basic a0hBYlZwcHg0NDpCZDJoOHJkWWhlcDZOS09P"));
            httpPost.setConfig(requestConfig);
            //新建文件对象并且设置文件
            FileBody bin = new FileBody(file);
            MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create();
            reqEntity.addPart("file", bin);
            //设置参数
            if (formParams != null && formParams.size() > 0) {
                for (NameValuePair nv : formParams) {
                    reqEntity.addTextBody(nv.getName(), nv.getValue(), ContentType.create("text/plain", Charset.forName(HTTP.UTF_8)));
                }
        httpPost.setConfig(requestConfig);
        //新建文件对象并且设置文件
        FileBody bin = new FileBody(file);
        MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create();
        reqEntity.addPart("file", bin);
        //设置参数
        if (formParams != null && formParams.size() > 0) {
            for (NameValuePair nv : formParams) {
                reqEntity.addTextBody(nv.getName(), nv.getValue(), ContentType.create("text/plain", Charset.forName(HTTP.UTF_8)));
            }
            httpPost.setEntity(reqEntity.build());
        }
        httpPost.setEntity(reqEntity.build());
        CloseableHttpResponse response = null;
        HttpEntity entity = null;
        try {
            //设置验证
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
@ -183,20 +192,24 @@ public class HttpClientUtil {
            } else {
                response = httpClient.execute(httpPost);
            }
            re.setStatusCode(response.getStatusLine().getStatusCode());
            re.setBody(EntityUtils.toString(response.getEntity(), "UTF-8"));;
        } catch (Exception e) {
            re.setStatusCode(201);
            re.setBody(e.getMessage());
            System.out.print(e.getMessage());
            entity = response.getEntity();
            return EntityUtils.toString(entity, "UTF-8");
        } catch (IOException e) {
            return e.getMessage();
        } finally {
            close(httpClient, response);
        }
        return re;
    }
    /**
     * 发送File
     *
     * @param filePath 文件路径
     * @param params   参数
     * @param url      http路径
     * @param username
     * @param password
     * @return
     */
    public static File downLoadFileByBase64(String filePath, Map<String, Object> params, String url, String username, String password) {
        File file = null;
@ -255,21 +268,25 @@ public class HttpClientUtil {
        return file;
    }
    /**
     * 下载文件
     */
    public static File downLoadFile(String filePath, String url, String username, String password) {
    public static File downLoadFile(String filePath, Map<String, Object> params, String url, String username, String password) {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = getCloseableHttpClient(null);
        try {
            HttpGet httpGet = new HttpGet(url);
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                formparams.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));
            }
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
            httpPost.setEntity(entity);
            httpPost.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
@ -278,9 +295,9 @@ public class HttpClientUtil {
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpGet, context);
                response = httpclient.execute(httpPost, context);
            } else {
                response = httpclient.execute(httpGet);
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            InputStream is = httpEntity.getContent();

+ 6 - 25
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/HttpHelper.java

@ -1,6 +1,6 @@
package com.yihu.ehr.util.httpclient;
import org.apache.http.NameValuePair;
import com.yihu.ehr.util.http.HopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.ssl.SSLContexts;
@ -11,10 +11,12 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
 * Created by hzp on 2016/3/10.
 */
public class HttpHelper {
    private static String defaultPropertiesPath = "config/http.properties";
    private static SSLConnectionSocketFactory defaultSSL;
@ -135,31 +137,10 @@ public class HttpHelper {
    }
    public static Response post(String url,Map<String,Object> params,Map<String,Object> header,SSLConnectionSocketFactory ssl,String user,String password)
    {
        return HttpClientUtil.request("POST",url,params,header,ssl,user,password);
    }
    public static Response postFile(String url, List<NameValuePair> formParams, String filePath)
    {
        File file = new File(filePath);
        if(url.startsWith("https"))
        {
            return HttpClientUtil.postFile(url, file, formParams, defaultSSL,defaultHttpUser,defaultHttpPassword);
        }
        else{
        //默认http不走ssl和用户密码
        return HttpClientUtil.postFile(url, file, formParams, null,defaultHttpUser,defaultHttpPassword);
    }
    }
    public static Response postFile(String url, List<NameValuePair> formParams, File file)
    {
        if(url.startsWith("https"))
        {
            return HttpClientUtil.postFile(url, file, formParams, defaultSSL,defaultHttpUser,defaultHttpPassword);
        }
        else{
            //默认http不走ssl和用户密码
            return HttpClientUtil.postFile(url, file, formParams, null,defaultHttpUser,defaultHttpPassword);
        }
    }
    /************************** Put方法 ******************************************/
    public static Response put(String url)
    {

+ 2 - 2
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/httpclient/Response.java

@ -14,8 +14,8 @@ public class Response {
        this.body = body;
    }
    private int statusCode;
    private String body;
    public int statusCode;
    public String body;
    public int getStatusCode() {

+ 0 - 35
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/json/JSON.java

@ -1,35 +0,0 @@
package com.yihu.ehr.util.json;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.file.FileUtil;
import net.sf.json.JSONObject;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
 * Created by chenweida on 2016/3/24.
 */
public class JSON {
    public static final String[] key = {"data", "event_no", "patient_id"};
    public static File json2File(Map<String,Object> params) {
        String dataset= (String) params.get("dataset");
        //先转json
        String jsonDataSet = XML2JSON.xml2JSON(dataset);
        JSONObject jo = new JSONObject();
        for(Map.Entry<String,Object> a:params.entrySet()){
            if(!"dataset".equals(a.getKey())){
                jo.put(a.getKey(),a.getValue());
            }
        }
        String jsonString=jo.toString();
        //json转文件
        String home = System.getProperty("catalina.home").replace('\\', '/');
        SimpleDateFormat sd=new SimpleDateFormat("yyyyMMddHHmmss");
        String filePath=home + File.separator +sd.format(new Date());
        return FileUtil.writeFile(filePath,jsonString);
    }
}

+ 0 - 37
Hos-Resource-Mini/src/main/java/com.yihu.ehr/util/json/XML2JSON.java

@ -1,37 +0,0 @@
package com.yihu.ehr.util.json;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
/**
 * Created by chenweida on 2016/3/24.
 */
public class XML2JSON {
    public static String xml2JSON(String xml) {
        return new XMLSerializer().read(xml).toString();
    }
    public static String json2XML(String json) {
        //json
        JSONObject jobj = JSONObject.fromObject(json);
        String xml = new XMLSerializer().write(jobj);
        return xml;
    }
    public static void main(String[] args) {
        System.out.println(xml2JSON("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Data><PATIENT_ID>病人ID</PATIENT_ID>\n" +
                "\t<EVENT_NO>门诊号(挂号号) / 住院号</EVENT_NO>\n" +
                "\t<HDSD00_05_040>检验报告单号</HDSD00_05_040>\n" +
                "\t<JDSD02_03_02>子项序号</JDSD02_03_02>\n" +
                "\t<JDSD02_03_03>子项的LOINC编码</JDSD02_03_03>\n" +
                "\t<JDSD02_03_13>子项目中文名称</JDSD02_03_13>\n" +
                "\t<JDSD02_03_14>子项目英文名称</JDSD02_03_14>\n" +
                "\t<JDSD02_03_04>结果类型</JDSD02_03_04>\n" +
                "\t<JDSD02_03_05>结果值</JDSD02_03_05>\n" +
                "\t<HDSD00_01_547>单位</HDSD00_01_547>\n" +
                "\t<JDSD02_03_06>正常参考值下限</JDSD02_03_06>\n" +
                "\t<JDSD02_03_07>正常参考值上限</JDSD02_03_07>\n" +
                "\t<JDSD02_03_08>参考值备注</JDSD02_03_08>\n" +
                "\t<JDSD02_03_09>结果值的解释</JDSD02_03_09></Data>"));
    }
}

+ 7 - 5
Hos-Resource-Mini/src/main/resources/config/crawler.properties

@ -2,9 +2,11 @@
agency.name=健康之路
#总支撑平台接口请求
ha.url.standard.getVersion=/api/v1.0/adaptions/version_plan
ha.url.patient.register=/api/v1.0/patient/registration
ha.url.patient.upload=/api/v1.0/packages/
ha.url.security.publicKey.get=/api/v1.0/securities/org_key/
ha.url.standard.allSchemaMappingPlan=/api/v1.0/adaptions/organization/adaption
ha.url.standard.getVersion=/rest/v1.0/adapter-dispatcher/versionplan
ha.url.patient.register=/rest/v1.0/patient/registration
ha.url.patient.upload=/rest/v1.0/json_package/
ha.url.security.publicKey.get=/rest/v1.0/security/user_key/
ha.url.security.token.get=/rest/v1.0/security/token
ha.url.standard.allSchemaMappingPlan=/rest/v1.0/adapter-dispatcher/allSchemaMappingPlan
ha.url.user.loginAction=/api/v1.0/authorizations/users
ha.url.user.org=/api/v1.0/authorizations/users

+ 2 - 5
Hos-Resource-Mini/src/main/resources/config/http.properties

@ -1,9 +1,6 @@
httpUrl = https://172.19.103.73:443/api/v1.0
#ÖÒhttps://192.168.131.15:4432/api/v1.0
  #https://172.19.103.73:443/api/v1.0
httpUrl = https://ehr.yihu.com
#https://192.168.131.151:443/
sslKeystore = I:/ssl/tomcat.keystore
sslPassword = 123456
clientId = kHAbVppx44

+ 8 - 0
Hos-Resource-Mini/src/main/resources/config/sys.config.xml

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <debug>true</debug>
    <!--存储模式:轻量模式:0,传统模式:1-->
    <platform>
        <url>https://172.19.103.49:5666/ehr</url>
        <user pwd="123456">2</user>
        <app secret="u2akgXkkRRkiiCVR">gAP3ma6grh</app>
        <trust_store pwd="123456"></trust_store>
        <basic_auth pwd="123456">admin</basic_auth>
    </platform>
    <event_no>
        <item>HDSD03_01_031</item>
        <item>HDSD00_01_579</item>

+ 1 - 1
Hos-Resource-Mini/src/main/resources/log4j2.xml

@ -26,7 +26,7 @@
                           pattern='%d{yyyy-MM-dd HH:mm:ss}-- %p %t %c - %m%n'/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="1 MB"/>
                <SizeBasedTriggeringPolicy size="10 MB"/>
            </Policies>
            <DefaultRolloverStrategy fileIndex="max" max="10"/>
        </RollingFile>

+ 4 - 3
Hos-Resource-Mini/src/main/resources/spring/applicationContext.xml

@ -3,17 +3,18 @@
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
>
       >
    <!--业务Beans, 使用注解方式配置-->
    <context:component-scan base-package="com.yihu">

+ 1 - 2
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/common/indexJs.jsp

@ -67,8 +67,7 @@
                {id: 2, text: '采集标准',icon:'${staticRoot}/images/index/menu2_icon.png', url: '${contextRoot}/datacollect/stdManager'},
                {id: 3, text: '任务跟踪',icon:'${staticRoot}/images/index/menu3_icon.png', url: '${contextRoot}/datacollect/trackJob'},
                {id: 4, text: '任务补采',icon:'${staticRoot}/images/index/menu4_icon.png', url: '${contextRoot}/datacollect/repeatJob'},
                {id: 5, text: '系统参数',icon:'${staticRoot}/images/index/menu5_icon.png', url: '${contextRoot}/system/paramManager'},
                {id: 6, text: '接口配置',icon:'${staticRoot}/images/index/menu5_icon.png', url: '${contextRoot}/dataAcquisition/dataAcquisitionManager'}
                {id: 5, text: '系统参数',icon:'${staticRoot}/images/index/menu5_icon.png', url: '${contextRoot}/system/paramManager'}
            ];
            me.menuTree = $('#ulTree').ligerTree({
                data: menu,

+ 0 - 18
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/dataAcquistion.jsp

@ -1,18 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/commons/commonInclude.jsp" %>
<div id="divMain" style="padding-top:10px;padding-left: 10px;padding-right:10px;">
    <div class="m-form-group" style="margin-bottom:10px;">
        <div class="m-form-control m-form-control-fr" style="float: right">
            <div id="div_new_record" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam">
                <span>新增</span>
            </div>
        </div>
    </div>
    <div id="divGrid">
    </div>
</div>

+ 0 - 154
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/dataAcquistionJs.jsp

@ -1,154 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/commons/commonInclude.jsp" %>
<script>
    var dataAcquistion = {
        grid:null,
        dialog:null,
        init:function(){
            var me = this;
            $("#txtTimeFrom").ligerDateEditor({width:150,showTime:true});
            $("#txtTimeTo").ligerDateEditor({width:150,showTime:true});
            dataAcquistion.grid = $("#divGrid").ligerGrid({
                url: '${contextRoot}/dataAcquisition/getDataAcquisition',
                columns: [
                    {display:'接口名称',name:'name', width:'20%'},
                    {display:'接口代码',name:'transactioncode', width:'10%'},
                    {display:'接口请求方式',name:'request_type', width:'10%',render:function(row,index,value){
                        if(value=="1")
                        //1是查询 2是文件上传
                            return "查询";
                        else if(value=="2")
                            return "文件上传";
                    }},
                    {display:'接口请求类型',name:'url_type', width:'10%',render:function(row,index,value){
                        if(value=="1")
                            return "POST";
                        else if(value=="2")
                            return "GET";
                    }},
                    {display:'远程接口URL',name:'url', width:  '30%',align:'center'},
                    {display:'操作',name:'adapter_dataset_code', width:  '19%', render: function (row) {
                            var html = '<div class="m-inline-buttons" style="width:90px;">';
                            html += '<a class="m-btn-edit" onclick="dataAcquistion.editData(\''+row.id+'\')"></a>';
                            html += '<a class="m-btn-delete" onclick="dataAcquistion.deleteData(\''+row.id+'\')"></a>';
                            html += '</div>';
                            return html;
                        }
                    }
                ],
                onDblClickRow: function (row) {
                    dataAcquistion.editData(row.id);
                },
            });
            $("#btnRepeat").click(function(){
                me.repeat();
            });
            $("#div_new_record").click(function(){
                dataAcquistion.editData();
            });
        },
        editData:function(id){
            var title = "新增接口配置";
            var params = null;
            if (id != undefined && id != null) {
                title = "编辑接口配置";
                params = {dataId: id};
            }
            dataAcquistion.dialog = $.ligerDialog.open({
                height: 420,
                width: 600,
                title: title,
                url: '${contextRoot}/dataAcquisition/editorDataAcq',
                //load: true,
                urlParms: params
            });
        },
        //删除补采
        deleteData:function(id){
            $.ligerDialog.confirm("是否确认要删除该条记录?", function (confirm) {
                if (confirm)
                {
                    $.ajax({
                        type: "POST",
                        url : "${contextRoot}/dataAcquisition/deleteDataAcquisition",
                        dataType : "json",
                        data:{id:id},
                        cache:false,
                        success :function(data){
                            if(data.successFlg) {
                                $.ligerDialog.success("删除成功");
                                dataAcquistion.grid.reload();
                            }
                            else{
                                $.ligerDialog.error(data.message);
                            }
                        },
                        error :function(data){
                            $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                        }
                    });
                }
            });
        },
        //弹窗返回
        dialogSuccess: function (message) {
            $.ligerDialog.success(message);
            dataAcquistion.grid.reload();
            this.dialog.close();
        },
        //新增补采
        repeat:function(){
            var me = this;
            var start = $("#txtTimeFrom").ligerDateEditor("getValue");
            var end = $("#txtTimeTo").ligerDateEditor("getValue");
            if(start==null||start.length==0)
            {
                $.ligerDialog.error("补采开始时间不能为空!");
                return;
            }
            if(end==null||end.length==0)
            {
                $.ligerDialog.error("补采结束时间不能为空!");
                return;
            }
            if(start>end)
            {
                $.ligerDialog.error("开始时间不能大于结束时间!");
                return;
            }
            $.ajax({
                type: "POST",
                url : "${contextRoot}/datacollect/addJobRepeat",
                dataType : "json",
                data:{startTime:start,endTime:end},
                cache:false,
                success :function(data){
                    if(data.successFlg) {
                        $.ligerDialog.success(data.message);
                        me.grid.reload();
                    }
                    else{
                        $.ligerDialog.error(data.message);
                    }
                },
                error :function(data){
                    $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                }
            });
        }
    };
    $(function(){
        dataAcquistion.init();
    });
</script>

+ 0 - 62
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/editorDataAcq.jsp

@ -1,62 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/commons/commonInclude.jsp" %>
<!--######机构管理页面 > 机构信息对话框模板页######-->
<div id="div_info_form" class="m-form-inline" style="padding-top:10px;" data-role-form>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>接口名称:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" name="name"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>接口代码:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" name="transactioncode"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>接口请求类型:</label>
        <div class="m-form-control">
                <input id="request_type" type="text" class="l-text-field required" name="request_type"/>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>接口请求方式:</label>
        <div class="m-form-control">
                <input id="url_type" type="text" class="l-text-field" name="url_type"/>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>url:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" name="url"/>
            </div>
        </div>
    </div>
    <!-- 隐藏字段 -->
    <div class="m-form-group" style="display: none;">
        <input name="id" hidden="hidden"/>
    </div>
    <div class="m-form-bottom">
        <div id="btnCancel" class="l-button l-button-no">
            <span>关闭</span>
        </div>
        <div id="btnSave" class="l-button">
            <span>保存</span>
        </div>
    </div>
</div>

+ 0 - 97
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/datacquisition/editorDataAcqJs.jsp

@ -1,97 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/commons/commonInclude.jsp" %>
<script type="text/javascript">
    /* *************************** 模块初始化 ***************************** */
    var editorData = {
        //form
        //$form: $("#div_info_form"),
        actionUrl: "${contextRoot}/dataAcquisition/addDataAcquisition",
        //validator: null,
        init: function () {
            this.initForm();
            this.bindEvents();
        },
        initForm: function () {
            var me = this;
            // me.$form.attrScan();
            var modelString = "${model.id}";
            var data;
            $('#request_type').ligerComboBox({
                width:100,
                data:[{value:"查询",code:"1"},
                    {value:"文件上传",code:"2"}
                ]});
            $('#url_type').ligerComboBox({
                width:100,
                data:[{value:"POST",code:"1"},
                    {value:"GET",code:"2"}
            ]});
            if (modelString != undefined && modelString != null && modelString.length > 0) {
                data = {
                    id: "${model.id}",
                    transactioncode: "${model.transactioncode}",
                    request_type: "${model.request_type}",
                    url_type: "${model.url_type}",
                    name: "${model.name}",
                    url: "${model.url}"
                };
                me.actionUrl = "${contextRoot}/dataAcquisition/updateDataAcquisition";
            }
            $("#div_info_form").ligerAutoForm({
                data: data,
                validate: {
                    code: "required",
                    name: {
                        required: true
                    }
                },
                message: {
                    code: "代码不能为空!",
                    name: "名称不能为空!"
                }
            });
        },
        bindEvents: function () {
            var me = this;
            $("#btnSave").click(function () {
                if (!$("#div_info_form").ligerAutoForm("validate")) {
                    return;
                }
                var data = $("#div_info_form").ligerAutoForm("getData");
                $.ajax({ //ajax处理
                    type: "POST",
                    url: me.actionUrl,
                    dataType: "json",
                    data: data,
                    cache: false,
                    success: function (data) {
                        if (data.successFlg) {
                            parent.dataAcquistion.dialogSuccess("保存成功");
                        }
                        else {
                            $.ligerDialog.error(data.message);
                        }
                    },
                    error: function (data) {
                        $.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
                    }
                });
            });
            $("#btnCancel").click(function () {
                parent.dataAcquistion.dialog.close();
            });
        }
    };
    $(function () {
        editorData.init();
    });
</script>

+ 2 - 2
Hos-Resource-Mini/src/main/webapp/WEB-INF/jsp/system/dataSourceJs.jsp

@ -54,7 +54,7 @@
            var resultStr="";
            if(data.type=="mysql"){//mysql
                resultStr ="jdbc:mysql://"+ data.ip +":"+ data.port +"/"+ data.dbName +"?user="+ data.dbUser +"&password="+ data.dbPassword +"&useUnicode=true&characterEncoding=UTF-8";
                resultStr ="jdbc:mysql://"+ data.ip +":"+ data.port +"/"+ data.dbName +"?user="+ data.dbUser +"&password="+ data.dbPassword;
            }
            else if(data.type=="oracle"){//oracle
                resultStr ="jdbc:oracle:thin:"+ data.dbUser +"/"+ data.dbPassword +"@//"+ data.ip +":"+ data.port +"/"+ data.dbName ;
@ -115,7 +115,7 @@
                type: "POST",
                url : "${contextRoot}/system/testDataSource",
                dataType : "json",
                data:{uri:me.getConfigString(data)},
                data:{config:me.getConfigString(data)},
                cache:false,
                success :function(data){
                    if(data.successFlg) {

+ 11 - 15
Hos-Resource-Mini/src/main/webapp/WEB-INF/web.xml

@ -9,20 +9,6 @@
        <listener-class>com.yihu.ehr.common.ApplicationStart</listener-class>
    </listener>
    <!--Spring-->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/applicationContext.xml</param-value>
    </context-param>
    <!--线程-->
    <listener>
        <listener-class>com.yihu.ehr.common.ThreadStart</listener-class>
    </listener>
    <!--servlet设-->
    <servlet>
        <servlet-name>dispatcher</servlet-name>
@ -63,7 +49,7 @@
        </init-param>
        <init-param>
            <param-name>notCheckURLList</param-name>
            <param-value>/loginPage;/system/loginAction;/error;/dataAcquisition/getData;/dataAcquisition/getDataAcquisition;</param-value>
            <param-value>/loginPage;/system/loginAction;/error</param-value>
        </init-param>
    </filter>
    <filter-mapping>
@ -71,6 +57,16 @@
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--Spring-->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/applicationContext.xml</param-value>
    </context-param>
    <!-- 默认页面 -->
    <welcome-file-list>
        <welcome-file>/indexPage</welcome-file>

+ 2 - 10
Hos-resource/Hos-Resource.iml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="web" name="Web">
      <configuration>
@ -11,14 +11,6 @@
        </webroots>
      </configuration>
    </facet>
    <facet type="Spring" name="Spring">
      <configuration>
        <fileset id="fileset" name="Spring Application Context" removed="false">
          <file>file://$MODULE_DIR$/src/main/webapp/WEB-INF/dispatcher-servlet.xml</file>
          <file>file://$MODULE_DIR$/src/main/resources/spring/applicationContext.xml</file>
        </fileset>
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
    <output url="file://$MODULE_DIR$/target/classes" />
@ -30,7 +22,7 @@
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="Maven: com.yihu.core:ehr-dbhelper:1.1.6" level="project" />
    <orderEntry type="library" name="Maven: com.yihu.core:ehr-dbhelper:1.1.5" level="project" />
    <orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.1.0" level="project" />
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:1.6.0.RELEASE" level="project" />
    <orderEntry type="library" name="Maven: org.springframework:spring-context:4.1.7.RELEASE" level="project" />

+ 6 - 6
Hos-resource/src/main/java/com/yihu/ehr/datacollect/controller/DataCollectController.java

@ -9,10 +9,8 @@ import com.yihu.ehr.framework.constrant.DateConvert;
import com.yihu.ehr.framework.model.ActionResult;
import com.yihu.ehr.framework.model.Result;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.operator.CollectionUtil;
import com.yihu.ehr.std.service.intf.IStdService;
import com.yihu.ehr.system.service.intf.IDatasourceManager;
import net.sf.json.JSONArray;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.PropertyUtils;
@ -23,7 +21,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
/**
 * 数据采集配置页面
@ -72,9 +73,8 @@ public class DataCollectController extends BaseController {
            }
            //获取方案列表
            List data = stdService.getSchemeVersion();
            JSONArray jsonArray = JSONArray.fromObject(data);
            model.addAttribute("schemeList", "{\"detailModelList\":"+(CollectionUtil.isEmpty(data)?"[]":jsonArray)+"}");
            String data = stdService.getSchemeVersion();
            model.addAttribute("schemeList", "{\"detailModelList\":"+(data.length()==0?"[]":data)+"}");
            model.addAttribute("contentPage", "/datacollect/editorJob");
            return "pageView";

+ 4 - 6
Hos-resource/src/main/java/com/yihu/ehr/datacollect/service/DatacollectManager.java

@ -10,8 +10,6 @@ import com.yihu.ehr.framework.model.DictItem;
import com.yihu.ehr.framework.model.SimpleChartItem;
import com.yihu.ehr.framework.util.quartz.QuartzManager;
import com.yihu.ehr.resource.model.RsDatasourceDataset;
import com.yihu.ehr.standard.model.adapter.AdapterDatasetModel;
import com.yihu.ehr.standard.model.standard.StdDataSetModel;
import com.yihu.ehr.std.service.intf.IStdService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@ -206,7 +204,7 @@ public class DatacollectManager implements IDatacollectManager {
    public DataGridResult getSchemeDataset(String schemeId,String schemeVersion,String jobId) throws Exception
    {
        //获取适配数据集总和
        List<AdapterDatasetModel> datasetString = stdManager.getDatasetByScheme(schemeVersion);
        String datasetString = stdManager.getDatasetByScheme(schemeVersion);
        JSONArray jsonArray =  JSONArray.fromObject(datasetString);
        //获取任务数据集
        List<RsJobDataset> jobDataset = datacollectDao.getJobDataset(jobId);
@ -255,7 +253,7 @@ public class DatacollectManager implements IDatacollectManager {
    public DataGridResult getSchemeDatasetCol(String schemeId,String schemeVersion,String datasetId) throws Exception
    {
        //获取适配字段
        List datacolString = stdManager.getDatacolByScheme(schemeVersion, datasetId);
        String datacolString = stdManager.getDatacolByScheme(schemeVersion, datasetId);
        JSONArray datacolList = JSONArray.fromObject(datacolString);
        DataGridResult re = new DataGridResult();
@ -400,8 +398,8 @@ public class DatacollectManager implements IDatacollectManager {
    public DataGridResult getDatasetSource(String stdVersion) throws Exception
    {
        //获取版本下全部数据集
        List<StdDataSetModel> stdDataSetModelList = stdManager.getDatasetByVersion(stdVersion);
        JSONArray datasetList = JSONArray.fromObject(stdDataSetModelList);
        String datasetString = stdManager.getDatasetByVersion(stdVersion);
        JSONArray datasetList = JSONArray.fromObject(datasetString);
        //获取已配数据集
        List<RsDatasourceDataset> jobDataset = datacollectDao.getDatasourceDataset(stdVersion);

+ 4 - 4
Hos-resource/src/main/java/com/yihu/ehr/datacollect/service/DatacollectService.java

@ -141,7 +141,7 @@ public class DatacollectService implements IDatacollectService {
                dictCol.setAdapterDictId(dictId);
                dictCol.setAdapterDataType(dictType.length()>0?dictType:"1");//默认通过code转换字典
                //获取字典数据
                List dictString = stdService.getDictByScheme(schemeVersion,dictId);
                String dictString = stdService.getDictByScheme(schemeVersion,dictId);
                JSONArray dictAdapterArray = new JSONArray(dictString);
                dictCol.setDictList(dictAdapterArray);
@ -253,7 +253,7 @@ public class DatacollectService implements IDatacollectService {
            DBType dbType = db.dbType;
            //获取数据集映射
            List datasetString = stdService.getDatasetByScheme(schemeVersion, datasetId);
            String datasetString = stdService.getDatasetByScheme(schemeVersion, datasetId);
            JSONArray datasetList = new JSONArray(datasetString);
            String stdTableName ="";
            String adapterTableName ="";
@ -264,7 +264,7 @@ public class DatacollectService implements IDatacollectService {
            }
            //获取数据集字段映射结构
            List colString = stdService.getDatacolByScheme(schemeVersion,datasetId);
            String colString = stdService.getDatacolByScheme(schemeVersion,datasetId);
            JSONArray colList = new JSONArray(colString);
            if(colList!=null && colList.length()>0)
@ -543,7 +543,7 @@ public class DatacollectService implements IDatacollectService {
        //获取数据集字段映射结构
        String schemeVersion = log.getSchemeVersion();
        String datasetId = log.getJobDatasetId();
        List colString = stdService.getDatacolByScheme(schemeVersion,datasetId);
        String colString = stdService.getDatacolByScheme(schemeVersion,datasetId);
        JSONArray colList = new JSONArray(colString);
        List<JSONObject> list = db.query(sql);
        String message = intoMongodb(list,schemeVersion,stdDatasetCode,colList);

+ 2 - 0
Hos-resource/src/main/java/com/yihu/ehr/resource/controller/RsResourceController.java

@ -507,7 +507,9 @@ public class RsResourceController extends BaseController {
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            String datasetId = request.getParameter("datasetId");
            String name = request.getParameter("name");
            params.put("datasetId", datasetId);
            params.put("name", name);
            return resourceService.getDataSet(params);
        } catch (Exception e) {
            e.printStackTrace();

+ 2 - 0
Hos-resource/src/main/java/com/yihu/ehr/resource/controller/RsResourceRestController.java

@ -99,8 +99,10 @@ public class RsResourceRestController {
        try {
            String page = request.getParameter("page");
            String rows = request.getParameter("rows");
            String categoryId = request.getParameter("categoryId");
            DataGridResult result = new DataGridResult(Integer.valueOf(page), Integer.valueOf(rows));
            Map<String, Object> conditionMap = new HashMap<>();
            conditionMap.put("categoryId",categoryId);
            result = resourceRestService.getResourceRestList(conditionMap, Integer.valueOf(page), Integer.valueOf(rows));
            return result;
        } catch (Exception e) {

+ 1 - 1
Hos-resource/src/main/java/com/yihu/ehr/resource/dao/impl/RsResourceRestDaoImpl.java

@ -19,7 +19,7 @@ public class RsResourceRestDaoImpl extends SQLGeneralDAO implements IRsResourceR
        sb.append(" from RsResourceRest r ");
        sb.append(" where 1=1 ");
        if (!StringUtils.isEmpty(conditionMap.get("categoryId"))) {
            sb.append(" and r.category = '" + conditionMap.get("categoryId") + "'");
            sb.append(" and r.name like '%" + conditionMap.get("categoryId") + "%'");
        }
        return super.getDataGridResult(sb.toString(), page, rows);
    }

+ 1 - 1
Hos-resource/src/main/java/com/yihu/ehr/resource/dao/impl/RsResourceRestDetailDaoImpl.java

@ -21,7 +21,7 @@ public class RsResourceRestDetailDaoImpl extends SQLGeneralDAO implements IRsRes
        sb.append(" from RsResourceRestDetail r ");
        sb.append(" where 1=1 ");
        if (!StringUtils.isEmpty(conditionMap.get("resourceRestId"))) {
            sb.append(" and r.resourceRestId = '" + conditionMap.get("resourceRestId") + "'");
            sb.append(" and r.name like '%" + conditionMap.get("resourceRestId") + "%'");
        }
        return super.getDataGridResult(sb.toString(), page, rows);
    }

+ 90 - 110
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/AdapterController.java

@ -1,60 +1,45 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.model.DictItem;
import com.yihu.ehr.framework.model.DictionaryResult;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterSchemeModel;
import com.yihu.ehr.standard.model.standard.StandardModel;
import com.yihu.ehr.standard.model.standard.StandardVersionModel;
import com.yihu.ehr.standard.model.standard.StdPublisherModel;
import com.yihu.ehr.standard.service.adapter.AdapterSchemeService;
import com.yihu.ehr.standard.service.standard.StandardService;
import com.yihu.ehr.standard.service.standard.StandardVersionService;
import com.yihu.ehr.standard.service.standard.StdPublisherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PathVariable;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController("AdapterController")
/**
 * Created by LLH on 2016/1/16.
 */
@Controller
@RequestMapping("/adapter")
@Api(protocols = "https", value = "AdapterController", description = "适配管理", tags = {"适配"})
public class AdapterController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = AdapterSchemeService.BEAN_ID)
    private AdapterSchemeService adapterSchemeService;
    @Resource(name = StandardService.BEAN_ID)
    private StandardService standardService;
    @Resource(name = StandardVersionService.BEAN_ID)
    private StandardVersionService standardVersionService;
    @Resource(name = StdPublisherService.BEAN_ID)
    private StdPublisherService stdPublisherService;
    /**
     * 查询适配方案首页信息(get)
     * @param condition
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/searchSchemesList")
    @ApiOperation(value = "获取适配方案列表", response = AdapterSchemeModel.class, responseContainer = "List", produces = "application/json", notes = "获取适配方案列表")
    public List<AdapterSchemeModel> getList(
            @ApiParam(name = "condition", value = "Search param,Must be json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        return adapterSchemeService.getEntityList(AdapterSchemeModel.class, condition, order, rows, page - 1, ErrorCode.GetSchemeListFailed);
    @RequestMapping("/searchSchemesList")
    @ResponseBody
    public String searchSchemesList(String condition) throws Exception {
        String url = "/api/v1.0/adapter_center/schemes";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("condition", condition);
        String resutl = HttpClientUtil.doGet( host+url, params, username, password);
        return resutl;
    }
    /**
@ -63,12 +48,14 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getForSchemeId")
    @ApiOperation(value = "获取适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "获取适配方案")
    public AdapterSchemeModel get(
            @ApiParam(name = "schemeId", value = "标准版本ID")
            @RequestParam(value = "schemeId") Integer schemeId) {
        return adapterSchemeService.get(schemeId);
    @RequestMapping("/getForSchemeId")
    @ResponseBody
    public String getForStandardId(Integer schemeId) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId",schemeId);
        String resutl = HttpClientUtil.doGet( host+url,params,username,password);
        return resutl;
    }
    /**
@ -78,11 +65,13 @@ public class AdapterController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/updateScheme")
    @ApiOperation(value = "修改适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "修改适配方案")
    public AdapterSchemeModel modify(
            @ApiParam(name = "scheme", value = "适配方案")
            @RequestParam(value = "scheme") String scheme) {
        return adapterSchemeService.update(scheme);
    @ResponseBody
    public String updateScheme(String scheme) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("scheme",scheme);
        String resutl = HttpClientUtil.doPut(host + url, params, username, password);
        return resutl;
    }
    /**
@ -91,12 +80,14 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/addScheme")
    @ApiOperation(value = "保存适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "保存适配方案")
    public AdapterSchemeModel add(
            @ApiParam(name = "scheme", value = "适配方案信息")
            @RequestParam(value = "scheme") String scheme) {
        return adapterSchemeService.add(scheme);
    @RequestMapping("/addScheme")
    @ResponseBody
    public String addScheme(String scheme) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("scheme",scheme);
        String resutl = HttpClientUtil.doPost(host + url, params, username, password);
        return resutl;
    }
    /**
@ -105,12 +96,14 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteScheme")
    @ApiOperation(value = "删除适配方案", produces = "application/json", notes = "删除适配方案")
    public void delete(
            @ApiParam(name = "schemeId", value = "适配方案ID")
            @RequestParam(value = "schemeId") Integer schemeId) {
        adapterSchemeService.delete(schemeId);
    @RequestMapping("/deleteScheme")
    @ResponseBody
    public String deleteScheme(Integer schemeId) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId",schemeId);
        String resutl = HttpClientUtil.doDelete(host + url, params, username, password);
        return resutl;
    }
    /**
@ -119,25 +112,23 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getStandards")
    @ApiOperation(value = "获取标准列表", response = DictionaryResult.class, produces = "application/json", notes = "获取标准列表")
    public DictionaryResult getStandardList(
            @ApiParam(name = "condition", value = "Must be Json,其中type为区分集成与应用标准")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Must be Json")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StandardModel> standardModelList = standardService.getList(condition, order, rows, page - 1);
    @RequestMapping("/getStandards")
    @ResponseBody
    public DictionaryResult getStandards(String condition) throws Exception {
        String url = "/api/v1.0/standard_center/standards";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("condition",condition);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        for(StandardModel standardModel : standardModelList){
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            Integer id = standardModel.getId();
            Integer  id = (Integer) jsonObject.get("id");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(standardModel.getName());
            items.setValue(name);
            detailModelList.add(items);
        }
        dictionaryResult.setDetailModelList(detailModelList);
@ -150,28 +141,21 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getVersions")
    @ApiOperation(value = "获取标准版本列表", response = DictionaryResult.class, produces = "application/json", notes = "获取标准版本列表")
    public DictionaryResult getVersionList(
            @ApiParam(name = "apiVersion", value = "API版本号", defaultValue = "v1.0")
            @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(name = "standardId", value = "标准ID")
            @RequestParam(value = "standardId") Integer standardId,
            @ApiParam(name = "condition", value = "Must be Json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Must be Json")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StandardVersionModel> standardVersionModelList = standardVersionService.getList(standardId, condition, order, rows, page - 1);
    @RequestMapping("/getVersions")
    @ResponseBody
    public DictionaryResult getVersions(Integer standardId) throws Exception {
        String url = "/api/v1.0/standard_center/versions";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standardId",standardId);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        for(StandardVersionModel standardVersionModel : standardVersionModelList){
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            String id = standardVersionModel.getVersion();
            String name = standardVersionModel.getName();
            String  id = (String) jsonObject.get("version");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(name);
            detailModelList.add(items);
@ -185,24 +169,20 @@ public class AdapterController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getPublishers")
    @ApiOperation(value = "获取发布机构列表", response = DictionaryResult.class, produces = "application/json", notes = "获取发布机构列表")
    public DictionaryResult getPublishers(
            @ApiParam(name = "condition", value = "Must be Json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Must be Json")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StdPublisherModel> stdPublisherModelList = stdPublisherService.getList(condition, order, rows, page - 1);
    @RequestMapping("/getPublishers")
    @ResponseBody
    public DictionaryResult getPublishers() throws Exception {
        String url = "/api/v1.0/standard_center/publishers";
        Map<String, Object> params = new HashMap<String, Object>();
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        for(StdPublisherModel stdPublisherModel : stdPublisherModelList){
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            String id = stdPublisherModel.getCode();
            String name = stdPublisherModel.getName();
            String  id = (String) jsonObject.get("code");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(name);
            detailModelList.add(items);

+ 65 - 61
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/AdapterVersionController.java

@ -1,44 +1,45 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.model.DictItem;
import com.yihu.ehr.framework.model.DictionaryResult;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterSchemeVersionModel;
import com.yihu.ehr.standard.service.adapter.AdapterSchemeVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("AdapterVersionController")
@Controller
@RequestMapping("/adapterversion")
@Api(protocols = "https", value = "AdapterVersionController", description = "适配版本管理", tags = {"适配"})
public class AdapterVersionController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = AdapterSchemeVersionService.BEAN_ID)
    private AdapterSchemeVersionService adapterSchemeVersion;
    /**
     * 根据版本id获取适配方案信息(get)
     * @param versionId
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getForVersionId")
    @ApiOperation(value = "获取适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "获取适配版本")
    public AdapterSchemeVersionModel getForVersionId(
            @ApiParam(name = "versionId", value = "适配版本ID")
            @RequestParam(value = "versionId") Integer versionId) {
        return adapterSchemeVersion.get(versionId);
    @RequestMapping("/getForVersionId")
    @ResponseBody
    public String getForVersionId(Integer versionId) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        String resutl = HttpClientUtil.doGet(host + url, params, username, password);
        return resutl;
    }
    /**
@ -47,12 +48,14 @@ public class AdapterVersionController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/addVersion")
    @ApiOperation(value = "保存适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "保存适配版本")
    public AdapterSchemeVersionModel add(
            @ApiParam(name = "version", value = "适配版本信息")
            @RequestParam(value = "version") String version) {
        return adapterSchemeVersion.add(version);
    @RequestMapping("/addVersion")
    @ResponseBody
    public String addVersion(String version) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String resutl = HttpClientUtil.doPost(host + url, params, username, password);
        return resutl;
    }
    /**
@ -61,12 +64,14 @@ public class AdapterVersionController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/updateVersion")
    @ApiOperation(value = "修改适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "修改适配版本")
    public AdapterSchemeVersionModel updateVersion(
            @ApiParam(name = "version", value = "标准版本")
            @RequestParam(value = "version") String version) {
        return adapterSchemeVersion.update(version);
    @RequestMapping("/updateVersion")
    @ResponseBody
    public String updateVersion(String version) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String resutl = HttpClientUtil.doPut(host + url, params, username, password);
        return resutl;
    }
    /**
@ -76,11 +81,13 @@ public class AdapterVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/publishVersion")
    @ApiOperation(value = "发布适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "修改适配版本")
    public AdapterSchemeVersionModel publishVersion(
            @ApiParam(name = "version", value = "标准版本")
            @RequestParam(value = "version") String version) {
        return adapterSchemeVersion.update(version);
    @ResponseBody
    public String publishVersion(String version) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String resutl = HttpClientUtil.doPut(host + url, params, username, password);
        return resutl;
    }
    /**
@ -89,12 +96,14 @@ public class AdapterVersionController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteVersion")
    @ApiOperation(value = "删除版本", produces = "application/json", notes = "删除版本")
    public void delete(
            @ApiParam(name = "versionId", value = "标准版本ID")
            @RequestParam(value = "versionId") Integer versionId) {
        adapterSchemeVersion.delete(versionId);
    @RequestMapping("/deleteVersion")
    @ResponseBody
    public String deleteVersion(Integer versionId) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        String resutl = HttpClientUtil.doDelete(host + url, params, username, password);
        return resutl;
    }
    /**
@ -103,31 +112,25 @@ public class AdapterVersionController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getVersions")
    @ApiOperation(value = "获取适配方案版本列表", response = DictionaryResult.class, produces = "application/json", notes = "获取标准版本列表")
    public DictionaryResult getList(
            @ApiParam(name = "schemeId", value = "适配方案ID")
            @RequestParam(value = "schemeId") Integer schemeId,
            @ApiParam(name = "condition", value = "Search param,Must be json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<AdapterSchemeVersionModel> adapterSchemeVersionModelList = adapterSchemeVersion.getEntityListByParentId(
                AdapterSchemeVersionModel.class, "schemeId", schemeId, condition, order, rows, page - 1, ErrorCode.GetSchemeVersionListFailed);
    @RequestMapping("/getVersions")
    @ResponseBody
    public DictionaryResult getVersions(Integer schemeId) throws Exception {
        String url = "/api/v1.0/adapter_center/versions";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId",schemeId);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        DictItem item = new DictItem();
        item.setCode("");
        item.setValue("-无-");
        detailModelList.add(item);
        for(AdapterSchemeVersionModel adapterSchemeVersionModel : adapterSchemeVersionModelList){
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            String id = adapterSchemeVersionModel.getVersion();
            String name = adapterSchemeVersionModel.getName();
            String  id = (String) jsonObject.get("version");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(name);
            detailModelList.add(items);
@ -135,4 +138,5 @@ public class AdapterVersionController extends BaseController {
        dictionaryResult.setDetailModelList(detailModelList);
        return dictionaryResult;
    }
}
}

+ 49 - 40
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/PublisherController.java

@ -1,39 +1,39 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.standard.StdPublisherModel;
import com.yihu.ehr.standard.service.standard.StdPublisherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("PublisherController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "PublisherController", description = "发布者管理", tags = {"发布者"})
public class PublisherController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = StdPublisherService.BEAN_ID)
    private StdPublisherService stdPublisherService;
    /**
     * 根据标准ID获取发布机构(get)
     * @param publisherId
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getForPublisherId")
    @ApiOperation(value = "获取发布机构", response = StdPublisherModel.class, produces = "application/json", notes = "获取发布机构")
    public StdPublisherModel get(
            @ApiParam(name = "publisherId", value = "机构ID")
            @RequestParam(value = "publisherId") Integer publisherId) {
        return stdPublisherService.get(publisherId);
    @RequestMapping("/getForPublisherId")
    @ResponseBody
    public String getForStandardId(Integer publisherId) throws Exception {
        String url = "/api/v1.0/standard_center/publisher";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("publisherId", publisherId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    /**
@ -41,10 +41,13 @@ public class PublisherController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getStandardPublisher")
    @ApiOperation(value = "获取发布机构", response = StdPublisherModel.class, produces = "application/json", notes = "获取发布机构")
    public StdPublisherModel get() {
        return stdPublisherService.getStandardPublisher();
    @RequestMapping("/getStandardPublisher")
    @ResponseBody
    public String getStandardPublisher() throws Exception {
        String url = "/api/v1.0/standard_center/publisher/standard";
        Map<String, Object> params = new HashMap<String, Object>();
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    /**
@ -53,12 +56,14 @@ public class PublisherController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/updatePublisher")
    @ApiOperation(value = "修改发布机构", response = StdPublisherModel.class, produces = "application/json", notes = "修改发布机构")
    public StdPublisherModel updatePublisher(
            @ApiParam(name = "publisher", value = "机构信息")
            @RequestParam(value = "publisher") String publisher) {
        return stdPublisherService.update(publisher);
    @RequestMapping("/updatePublisher")
    @ResponseBody
    public String updateStandard(String publisher) throws Exception {
        String url = "/api/v1.0/standard_center/publisher";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("publisher", publisher);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -67,12 +72,14 @@ public class PublisherController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/addPublisher")
    @ApiOperation(value = "保存发布机构", response = StdPublisherModel.class, produces = "application/json", notes = "保存发布机构")
    public StdPublisherModel addPublisher(
            @ApiParam(name = "publisher", value = "机构信息")
            @RequestParam(value = "publisher") String publisher) {
        return stdPublisherService.add(publisher);
    @RequestMapping("/addPublisher")
    @ResponseBody
    public String addStandard(String publisher) throws Exception {
        String url = "/api/v1.0/standard_center/publisher";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("publisher", publisher);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -81,12 +88,14 @@ public class PublisherController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deletePublisher")
    @ApiOperation(value = "删除发布机构", produces = "application/json", notes = "删除发布机构")
    public void deletePublisher(
            @ApiParam(name = "publisherId", value = "机构ID")
            @RequestParam(value = "publisherId") Integer publisherId) {
        stdPublisherService.delete(publisherId);
    @RequestMapping("/deletePublisher")
    @ResponseBody
    public String deleteStandard(Integer publisherId) throws Exception {
        String url = "/api/v1.0/standard_center/publisher";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("publisherId", publisherId);
        String result = HttpClientUtil.doDelete(host + url, params, username, password);
        return result;
    }
}

+ 55 - 44
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeController.java

@ -1,37 +1,39 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterSchemeModel;
import com.yihu.ehr.standard.model.adapter.resultModel.SchemeResultDetailModel;
import com.yihu.ehr.standard.service.adapter.AdapterSchemeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
@RestController("SchemeController")
/**
 * Created by LLH on 2016/1/16.
 */
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeController", description = "适配方案管理", tags = {"适配方案"})
public class SchemeController extends BaseController {
    @Resource(name = AdapterSchemeService.BEAN_ID)
    private AdapterSchemeService adapterSchemeService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询适配方案首页信息(get)
     * @param condition
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/searchScheme")
    @ApiOperation(value = "获取方案列表", response = SchemeResultDetailModel.class, responseContainer = "List", notes = "获取方案列表")
    public List<SchemeResultDetailModel> searchScheme(
            @ApiParam(name = "condition", value = "查询条件:适配方案名称、适配方案版本名称")
            @RequestParam(value = "condition", required = false) String condition) {
        return adapterSchemeService.getSchemeList(condition);
    @RequestMapping("/searchScheme")
    @ResponseBody
    public String searchSchemesList(String condition) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("condition", condition);
        String result = HttpClientUtil.doGet(host+url, params, username, password);
        return result;
    }
    /**
@ -40,12 +42,14 @@ public class SchemeController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getForSchemeId")
    @ApiOperation(value = "获取适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "获取适配方案")
    public AdapterSchemeModel getForSchemeId(
            @ApiParam(name = "schemeId", value = "标准版本ID")
            @RequestParam(value = "schemeId") Integer schemeId) {
        return adapterSchemeService.get(schemeId);
    @RequestMapping("/getForSchemeId")
    @ResponseBody
    public String getForStandardId(Integer schemeId) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId",schemeId);
        String result = HttpClientUtil.doGet( host+url,params,username,password);
        return result;
    }
    /**
@ -54,12 +58,14 @@ public class SchemeController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/updateScheme")
    @ApiOperation(value = "修改适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "修改适配方案")
    public AdapterSchemeModel updateScheme(
            @ApiParam(name = "scheme", value = "适配方案")
            @RequestParam(value = "scheme") String scheme) {
        return adapterSchemeService.update(scheme);
    @RequestMapping("/updateScheme")
    @ResponseBody
    public String updateScheme(String scheme) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("scheme",scheme);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -68,12 +74,14 @@ public class SchemeController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/addScheme")
    @ApiOperation(value = "保存适配方案", response = AdapterSchemeModel.class, produces = "application/json", notes = "保存适配方案")
    public AdapterSchemeModel addScheme(
            @ApiParam(name = "scheme", value = "适配方案信息")
            @RequestParam(value = "scheme") String scheme) {
        return adapterSchemeService.add(scheme);
    @RequestMapping("/addScheme")
    @ResponseBody
    public String addScheme(String scheme) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("scheme",scheme);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -82,11 +90,14 @@ public class SchemeController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/deleteScheme")
    @ApiOperation(value = "删除适配方案", produces = "application/json", notes = "删除适配方案")
    public void deleteScheme(
            @ApiParam(name = "schemeId", value = "适配方案ID")
            @RequestParam(value = "schemeId") Integer schemeId) {
        adapterSchemeService.delete(schemeId);
    @RequestMapping("/deleteScheme")
    @ResponseBody
    public String deleteScheme(Integer schemeId) throws Exception {
        String url = "/api/v1.0/adapter_center/scheme";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId",schemeId);
        String result = HttpClientUtil.doDelete(host + url, params, username, password);
        return result;
    }
}

+ 83 - 85
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDatasetController.java

@ -1,34 +1,29 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.constrant.TreeView;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterDatasetModel;
import com.yihu.ehr.standard.service.adapter.AdapterDatasetService;
import com.yihu.ehr.standard.service.bo.AdapterVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.standard.model.AdapterDatasetModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("SchemeDatasetController")
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeDatasetController", description = "适配数据集管理", tags = {"适配数据集"})
public class SchemeDatasetController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = AdapterDatasetService.BEAN_ID)
    private AdapterDatasetService datasetService;
    /**
     * 查询数据集列表信息(get)
     * @param adapterVersion
@ -39,22 +34,23 @@ public class SchemeDatasetController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/searchDatasetList")
    @ApiOperation(value = "获取数据集列表", response = Result.class, produces = "application/json", notes = "获取数据集列表")
    public Result getDatasetList(
            @ApiParam(name = "adapterVersion", value = "适配方案版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "condition", value = "查询条件:编码或名称")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @RequestMapping("/searchDatasetList")
    @ResponseBody
    public Result searchDatasetList(String adapterVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/adapter_center/datasets/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        List<AdapterDatasetModel> dataSetModelList = datasetService.getDatasetList(AdapterDatasetModel.class, adapterVersion, condition, order, rows, page - 1);;
        Integer count = datasetService.getDatasetInt(AdapterDatasetModel.class, adapterVersion, condition);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<AdapterDatasetModel> dataSetModelList = jsonArrayToList(resultStr, AdapterDatasetModel.class);
        url = "/api/v1.0/adapter_center/datasets/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(dataSetModelList);
        result.setTotalCount(count);
@ -62,69 +58,71 @@ public class SchemeDatasetController extends BaseController {
    }
    @RequestMapping("/getForDatasetId")
    @ApiOperation(value = "获取适配数据集", response = AdapterDatasetModel.class, produces = "application/json", notes = "获取适配数据集")
    public AdapterDatasetModel getForDatasetId(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "datasetId", value = "适配数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId) {
        AdapterVersion version = new AdapterVersion(adapterVersion);
        return (AdapterDatasetModel) datasetService.get(AdapterDatasetModel.class, version.getDataSetTableName(), datasetId, ErrorCode.GetDataSetListFailed);
    @ResponseBody
    public String getForDatasetId(String adapterVersion, Integer datasetId) throws Exception {
        String url = "/api/v1.0/adapter_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("datasetId", datasetId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping(value = "/delDataset")
    @ApiOperation(value = "删除数据集", produces = "application/json", notes = "删除适配数据集")
    public void delDataset(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "datasetId", value = "适配数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId) {
        datasetService.delete(adapterVersion, datasetId);
    @RequestMapping("/delDataset")
    @ResponseBody
    public String delDataset(String adapterVersion, Integer id) throws Exception {
        String url = "/api/v1.0/adapter_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("datasetId", id);
        String result = HttpClientUtil.doDelete(host+url,params,username,password);
        return result;
    }
    @RequestMapping(value = "/updateDataset")
    @ApiOperation(value = "修改适配数据集", response = AdapterDatasetModel.class, produces = "application/json", notes = "修改适配数据集")
    public AdapterDatasetModel modify(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dataset", value = "数据集,JSON")
            @RequestParam(value = "dataset") String dataset) {
        return datasetService.modify(adapterVersion, dataset);
    @RequestMapping("/updateDataset")
    @ResponseBody
    public String updateDataset(String adapterVersion, String dataset) throws Exception {
        String url = "/api/v1.0/adapter_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dataset", dataset);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value = "/addDataset")
    @ApiOperation(value = "保存适配数据集", response = AdapterDatasetModel.class, produces = "application/json", notes = "保存数据集")
    public AdapterDatasetModel add(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dataset", value = "数据集信息")
            @RequestParam(value = "dataset") String dataset) {
        return datasetService.add(adapterVersion, dataset);
    @RequestMapping("/addDataset")
    @ResponseBody
    public String addDataset(String adapterVersion, String dataset) throws Exception {
        String url = "/api/v1.0/adapter_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dataset", dataset);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value = "/getAdapterDataset")
    @ApiOperation(value = "获取定制数据集列表", response = TreeView.class, responseContainer = "List",produces = "application/json", notes = "获取数据集列表")
    public List<TreeView> getDatasetCustomize(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion) {
        return datasetService.getDatasetCustomize(adapterVersion, stdVersion);
    @RequestMapping("/getAdapterDataset")
    @ResponseBody
    public String getAdapterDataset(String adapterVersion,String stdVersion) throws Exception {
        String url = "/api/v1.0/adapter_center/datasets/customization";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("stdVersion", stdVersion);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value = "/saveAdapterDataset", method = RequestMethod.POST)
    @ApiOperation(value = "定制适配数据集", response = TreeView.class, responseContainer = "List",produces = "application/json", notes = "获取数据集列表")
    public boolean adapterDataSet(
            @ApiParam(name = "schemeId", value = "适配方案ID")
            @RequestParam(value = "schemeId") Integer schemeId,
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "datasetIdStr", value = "适配数据集信息")
            @RequestParam(value = "datasetIdStr") String datasetIdStr,
            @ApiParam(name = "metaDataIdStr", value = "适配数据元信息")
            @RequestParam(value = "metaDataIdStr") String metaDataIdStr) throws UnsupportedEncodingException {
        return datasetService.updateCustomize(schemeId, adapterVersion, stdVersion, datasetIdStr,metaDataIdStr);
    @RequestMapping(value = "/saveAdapterDataset",method = RequestMethod.POST)
    @ResponseBody
    public String saveAdapterDataset(Integer schemeId,String adapterVersion,String stdVersion,String datasetIdStr,String metaDataIdStr) throws Exception {
        String url = "/api/v1.0/adapter_center/datasets/customization";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("schemeId", schemeId);
        params.put("adapterVersion", adapterVersion);
        params.put("stdVersion", stdVersion);
        params.put("datasetIdStr", datasetIdStr.replaceAll("AD",""));
        params.put("metaDataIdStr", metaDataIdStr.replaceAll("AM",""));
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
}

+ 63 - 62
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDictController.java

@ -1,31 +1,28 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterDictModel;
import com.yihu.ehr.standard.service.adapter.AdapterDictService;
import com.yihu.ehr.standard.service.bo.AdapterVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.standard.model.AdapterDictModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("SchemeDictController")
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeDictController", description = "适配字典管理", tags = {"适配字典"})
public class SchemeDictController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = AdapterDictService.BEAN_ID)
    private AdapterDictService dictService;
    /**
     * 查询字典列表信息(get)
     * @param adapterVersion
@ -36,67 +33,71 @@ public class SchemeDictController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/searchDictList")
    @ApiOperation(value = "获取字典列表", response = Result.class, produces = "application/json", notes = "获取字典列表")
    public Result searchDictList(
            @ApiParam(name = "adapterVersion", value = "适配标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "condition", value = "查询条件:编码或名称")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<AdapterDictModel> dictModelList = dictService.getDictList(AdapterDictModel.class, adapterVersion, condition, order, rows, page - 1);
    @RequestMapping("/searchDictList")
    @ResponseBody
    public Result searchDictList(String adapterVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/adapter_center/dicts/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        Integer count = dictService.getDictInt(AdapterDictModel.class, adapterVersion, condition);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<AdapterDictModel> dictModelList = jsonArrayToList(resultStr, AdapterDictModel.class);
        url = "/api/v1.0/adapter_center/dicts/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(dictModelList);
        result.setTotalCount(count);
        return result;
    }
    @RequestMapping(value = "/getForDictId")
    @ApiOperation(value = "获取字典", response = AdapterDictModel.class, produces = "application/json", notes = "获取字典")
    public AdapterDictModel get(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictId", value = "字典ID")
            @RequestParam(value = "dictId") Integer dictId) {
        AdapterVersion version = new AdapterVersion(adapterVersion);
        return (AdapterDictModel) dictService.get(AdapterDictModel.class, version.getDictTableName(), dictId, ErrorCode.GetDictFaild);
    @RequestMapping("/getForDictId")
    @ResponseBody
    public String getForDictId(String adapterVersion, Integer dictId) throws Exception {
        String url = "/api/v1.0/adapter_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dictId", dictId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping(value = "/delDict")
    @ApiOperation(value = "删除字典", produces = "application/json", notes = "删除字典")
    public void delDict(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictId", value = "字典ID")
            @RequestParam(value = "dictId") Integer dictId) {
        dictService.delete(adapterVersion, dictId);
    @RequestMapping("/delDict")
    @ResponseBody
    public String delDict(String adapterVersion, Integer id) throws Exception {
        String url = "/api/v1.0/adapter_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dictId", id);
        String result = HttpClientUtil.doDelete(host+url,params,username,password);
        return result;
    }
    
    @RequestMapping(value = "/updateDict")
    @ApiOperation(value = "修改字典", response = AdapterDictModel.class, produces = "application/json", notes = "修改字典")
    public AdapterDictModel updateDict(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dict", value = "字典")
            @RequestParam(value = "dict") String dict) {
        return dictService.modify(adapterVersion, dict);
    @RequestMapping("/updateDict")
    @ResponseBody
    public String updateDict(String adapterVersion, String dict) throws Exception {
        String url = "/api/v1.0/adapter_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dict", dict);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value = "/addDict")
    @ApiOperation(value = "保存字典", response = AdapterDictModel.class, produces = "application/json", notes = "保存字典")
    public AdapterDictModel addDict(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dict", value = "字典")
            @RequestParam(value = "dict") String dict) {
        return dictService.add(adapterVersion, dict);
    @RequestMapping("/addDict")
    @ResponseBody
    public String addDict(String adapterVersion, String dict) throws Exception {
        String url = "/api/v1.0/adapter_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dict", dict);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
}

+ 72 - 73
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeDictEntryController.java

@ -1,32 +1,28 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterDictentryModel;
import com.yihu.ehr.standard.model.adapter.resultModel.AdapterDictEntryResultDetailModel;
import com.yihu.ehr.standard.service.adapter.AdapterDictentryService;
import com.yihu.ehr.standard.service.bo.AdapterVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.standard.model.AdapterDictEntryResultDetailModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("SchemeDictEntryController")
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeDictEntryController", description = "适配字典项管理", tags = {"适配字典项"})
public class SchemeDictEntryController extends BaseController {
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    @Resource(name = AdapterDictentryService.BEAN_ID)
    private AdapterDictentryService dictentryService;
    /**
     * 查询字典项列表信息(get)
     * @param adapterVersion
@ -37,79 +33,82 @@ public class SchemeDictEntryController extends BaseController {
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/searchDictEntryList")
    @ApiOperation(value = "获取字典项列表", response = Result.class, produces = "application/json", notes = "获取字典项列表")
    public Result getDictEntryList(
            @ApiParam(name = "adapterVersion", value = "适配版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "condition", value = "查询条件")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<AdapterDictEntryResultDetailModel> detailModelList = dictentryService.getDictEntryList(AdapterDictentryModel.class, adapterVersion, condition, order, rows, page - 1);
        Integer count = dictentryService.getDictEntryInt(AdapterDictentryModel.class, adapterVersion, condition);
    @RequestMapping("/searchDictEntryList")
    @ResponseBody
    public Result searchDictEntryList(String adapterVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntrys/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<AdapterDictEntryResultDetailModel> detailModelList = jsonArrayToList(resultStr, AdapterDictEntryResultDetailModel.class);
        url = "/api/v1.0/adapter_center/dictEntrys/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(detailModelList);
        result.setTotalCount(count);
        return result;
    }
    @RequestMapping(value = "/getForDictEntryId")
    @ApiOperation(value = "获取字典项", response = AdapterDictentryModel.class, produces = "application/json", notes = "获取字典项")
    public AdapterDictentryModel get(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictEntryId", value = "字典项ID")
            @RequestParam(value = "dictEntryId") Integer dictentryId) {
        AdapterVersion version = new AdapterVersion(adapterVersion);
        return (AdapterDictentryModel) dictentryService.get(AdapterDictentryModel.class, version.getDictEntryTableName(), dictentryId, ErrorCode.GetDictEntryFailed);
    @RequestMapping("/getForDictEntryId")
    @ResponseBody
    public String getForDictEntryId(String adapterVersion, Integer dictId, Integer dictEntryId) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dictId", dictId);
        params.put("dictEntryId", dictEntryId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping(value = "/updateDictEntry")
    @ApiOperation(value = "修改字典项", response = AdapterDictentryModel.class, produces = "application/json", notes = "修改字典项")
    public AdapterDictentryModel updateDictEntry(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictEntry", value = "字典项")
            @RequestParam(value = "dictEntry") String dictEntry) {
        return dictentryService.modify(adapterVersion, dictEntry);
    @RequestMapping("/updateDictEntry")
    @ResponseBody
    public String updateDictEntry(String adapterVersion, String dictEntry) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dictEntry", dictEntry);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value = "/addDictEntry")
    @ApiOperation(value = "保存字典项", response = AdapterDictentryModel.class, produces = "application/json", notes = "保存字典项")
    public AdapterDictentryModel add(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictEntry", value = "字典项")
            @RequestParam(value = "dictEntry") String dictEntry) {
        return dictentryService.add(adapterVersion, dictEntry);
    @RequestMapping("/addDictEntry")
    @ResponseBody
    public String addDictEntry(String adapterVersion, String dictEntry) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("dictEntry", dictEntry);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/updateDictEntrys")
    @ApiOperation(value = "保存字典项", response = AdapterDictEntryResultDetailModel.class, responseContainer = "list", produces = "application/json", notes = "保存数据元")
    public List<AdapterDictEntryResultDetailModel> updateDictEntrys(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "list", value = "字典项列表")
            @RequestParam(value = "list") String list) {
        return  dictentryService.updateDictEntrys(adapterVersion, list);
    @ResponseBody
    public String updateDictEntrys(String adapterVersion, String list) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntrys";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("list", list);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/delDictEntry")
    @ApiOperation(value = "删除字典项", response = AdapterDictentryModel.class, produces = "application/json", notes = "删除字典项,若字典项表为空管理字典清掉")
    public void delete(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "dictEntryId", value = "字典项ID")
            @RequestParam(value = "dictEntryId") Integer dictEntryId,
            @ApiParam(name = "stdDictId", value = "标准字典ID")
            @RequestParam(value = "stdDictId") Integer stdDictId,
            @ApiParam(name = "adapterDictId", value = "适配字典ID")
            @RequestParam(value = "adapterDictId") Integer adapterDictId) {
        dictentryService.deleteMultiple(adapterVersion, dictEntryId, stdDictId, adapterDictId);
    @ResponseBody
    public boolean delDictEntry(String adapterVersion, String list) throws Exception {
        String url = "/api/v1.0/adapter_center/dictEntry/single";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("list", list);
        HttpClientUtil.doDelete(host+url,params,username,password);
        return true;
    }
}

+ 69 - 69
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeMetadataController.java

@ -1,31 +1,28 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.ErrorCode;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterMetadataModel;
import com.yihu.ehr.standard.model.adapter.resultModel.ApiMetadataResultDetailModel;
import com.yihu.ehr.standard.service.adapter.AdapterMetadataService;
import com.yihu.ehr.standard.service.bo.AdapterVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.standard.model.ApiMetadataResultDetailModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("SchemeMetadataController")
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeMetadataController", description = "适配字典管理", tags = {"适配字典"})
public class SchemeMetadataController extends BaseController {
    @Resource(name = AdapterMetadataService.BEAN_ID)
    private AdapterMetadataService metadataService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询数据元列表信息(get)
     * @param adapterVersion
@ -37,20 +34,22 @@ public class SchemeMetadataController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchMetadataList")
    @ApiOperation(value = "获取数据元列表", response = Result.class, produces = "application/json", notes = "获取数据元列表")
    public Result getMetadataList(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "condition", value = "查询条件")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<ApiMetadataResultDetailModel> metadataModelList = metadataService.getMetadataList(AdapterMetadataModel.class, adapterVersion, condition, order, rows, page - 1);
        Integer count = metadataService.getMetadataCount(AdapterMetadataModel.class, adapterVersion, condition);
    @ResponseBody
    public Result searchMetadataList(String adapterVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/adapter_center/metadatas/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<ApiMetadataResultDetailModel> metadataModelList = jsonArrayToList(resultStr, ApiMetadataResultDetailModel.class);
        url = "/api/v1.0/adapter_center/metadatas/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(metadataModelList);
        result.setTotalCount(count);
@ -58,57 +57,58 @@ public class SchemeMetadataController extends BaseController {
    }
    @RequestMapping("/getForMetadataId")
    @ApiOperation(value = "获取数据元", response = AdapterMetadataModel.class, produces = "application/json", notes = "获取数据元")
    public AdapterMetadataModel get(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "metadataId", value = "数据元ID")
            @RequestParam(value = "metadataId") Integer metadataId) {
        AdapterVersion version = new AdapterVersion(adapterVersion);
        return (AdapterMetadataModel) metadataService.get(AdapterMetadataModel.class, version.getMetaDataTableName(), metadataId, ErrorCode.GetMetaDataFailed);
    @ResponseBody
    public String getForMetadataId(String adapterVersion, Integer datasetId, Integer metadataId) throws Exception {
        String url = "/api/v1.0/adapter_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("datasetId", datasetId);
        params.put("metadataId", metadataId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/updateMetadata")
    @ApiOperation(value = "修改数据元", response = AdapterMetadataModel.class, produces = "application/json", notes = "修改数据元")
    public AdapterMetadataModel updateMetadata(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "metadata", value = "数据元")
            @RequestParam(value = "metadata") String metadata) {
        return metadataService.modify(adapterVersion, metadata);
    @ResponseBody
    public String updateMetadata(String adapterVersion, String metadata) throws Exception {
        String url = "/api/v1.0/adapter_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("metadata", metadata);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/addMetadata")
    @ApiOperation(value = "保存数据元", response = AdapterMetadataModel.class, produces = "application/json", notes = "保存数据元")
    public AdapterMetadataModel addMetadata(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "metadata", value = "数据元")
            @RequestParam(value = "metadata") String metadata) {
        return metadataService.add(adapterVersion, metadata);
    @ResponseBody
    public String addMetadata(String adapterVersion, String metadata) throws Exception {
        String url = "/api/v1.0/adapter_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("metadata", metadata);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/updateMetadatas")
    @ApiOperation(value = "保存数据元", response = ApiMetadataResultDetailModel.class, responseContainer = "list", produces = "application/json", notes = "保存数据元")
    public List<ApiMetadataResultDetailModel> updateMetadatas(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "list", value = "数据元列表")
            @RequestParam(value = "list") String list) {
        return metadataService.updateMetadatas(adapterVersion, list);
    @ResponseBody
    public String updateMetadatas(String adapterVersion, String list) throws Exception {
        String url = "/api/v1.0/adapter_center/metadatas";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("list", list);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/delMetadata")
    @ApiOperation(value = "删除数据元", produces = "application/json", notes = "删除数据元")
    public void delete(
            @ApiParam(name = "adapterVersion", value = "标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "metadataId", value = "数据元ID")
            @RequestParam(value = "metadataId") Integer metadataId,
            @ApiParam(name = "stdDatasetId", value = "标准数据集ID")
            @RequestParam(value = "stdDatasetId") Integer stdDatasetId,
            @ApiParam(name = "adapterDatasetId", value = "适配数据集ID")
            @RequestParam(value = "adapterDatasetId") Integer adapterDatasetId) {
        metadataService.deleteMultiple(adapterVersion, metadataId, stdDatasetId, adapterDatasetId);
    @ResponseBody
    public boolean delDictEntry(String adapterVersion, String list) throws Exception {
        String url = "/api/v1.0/adapter_center/metadata/single";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("adapterVersion", adapterVersion);
        params.put("list", list);
        HttpClientUtil.doDelete(host+url,params,username,password);
        return true;
    }
}

+ 51 - 39
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/SchemeVersionController.java

@ -1,23 +1,25 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.adapter.AdapterSchemeVersionModel;
import com.yihu.ehr.standard.service.adapter.AdapterSchemeVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RestController("SchemeVersionController")
/**
 * Created by LLH on 2016/1/6.
 */
@Controller
@RequestMapping("/adapterCenter")
@Api(protocols = "https", value = "SchemeVersionController", description = "适配版本管理", tags = {"适配版本"})
public class SchemeVersionController extends BaseController {
    @Resource(name = AdapterSchemeVersionService.BEAN_ID)
    private AdapterSchemeVersionService adapterSchemeVersion;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 根据版本id获取适配方案信息(get)
     * @param versionId
@ -25,11 +27,13 @@ public class SchemeVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getForVersionId")
    @ApiOperation(value = "获取适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "获取适配版本")
    public AdapterSchemeVersionModel get(
            @ApiParam(name = "versionId", value = "适配版本ID")
            @RequestParam(value = "versionId") Integer versionId) {
        return adapterSchemeVersion.get(versionId);
    @ResponseBody
    public String getForVersionId(Integer versionId) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        return result;
    }
    /**
@ -39,11 +43,13 @@ public class SchemeVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/addVersion")
    @ApiOperation(value = "保存适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "保存适配版本")
    public AdapterSchemeVersionModel add(
            @ApiParam(name = "version", value = "适配版本信息")
            @RequestParam(value = "version") String version) {
        return adapterSchemeVersion.add(version);
    @ResponseBody
    public String addVersion(String version) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -53,11 +59,13 @@ public class SchemeVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/updateVersion")
    @ApiOperation(value = "修改适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "修改适配版本")
    public AdapterSchemeVersionModel modify(
            @ApiParam(name = "version", value = "标准版本")
            @RequestParam(value = "version") String version) {
        return adapterSchemeVersion.update(version);
    @ResponseBody
    public String updateVersion(String version) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -67,13 +75,14 @@ public class SchemeVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/publishVersion")
    @ApiOperation(value = "发布适配版本", response = AdapterSchemeVersionModel.class, produces = "application/json", notes = "发布适配版本")
    public AdapterSchemeVersionModel publish(
            @ApiParam(name = "versionId", value = "适配版本ID")
            @RequestParam(value = "versionId") Integer versionId,
            @ApiParam(name = "publisher", value = "发布者")
            @RequestParam(value = "publisher", required = false) String publisher) {
        return adapterSchemeVersion.publish(versionId, publisher);
    @ResponseBody
    public String publishVersion(Integer versionId, String publisher) throws Exception {
        String url = "/api/v1.0/adapter_center/version/publish";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId", versionId);
        params.put("publisher", publisher);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -83,10 +92,13 @@ public class SchemeVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/deleteVersion")
    @ApiOperation(value = "删除版本", produces = "application/json", notes = "删除版本")
    public void delete(
            @ApiParam(name = "versionId", value = "标准版本ID")
            @RequestParam(value = "versionId") Integer versionId) {
        adapterSchemeVersion.delete(versionId);
    @ResponseBody
    public String deleteVersion(Integer versionId) throws Exception {
        String url = "/api/v1.0/adapter_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        String result = HttpClientUtil.doDelete(host + url, params, username, password);
        return result;
    }
}

+ 56 - 44
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StandardController.java

@ -1,26 +1,26 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.operator.StringUtil;
import com.yihu.ehr.standard.model.standard.StandardModel;
import com.yihu.ehr.standard.model.standard.resultModel.StandardResultDetailModel;
import com.yihu.ehr.standard.service.standard.StandardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.standard.model.StandardResultDetailModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController("StandardController")
/**
 * Created by LLH on 2016/1/6.
 */
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StandardController", description = "标准管理", tags = {"标准"})
public class StandardController extends BaseController {
    @Resource(name = StandardService.BEAN_ID)
    private StandardService standardService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询集成标准首页信息(get)
@ -29,11 +29,13 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchStandard")
    @ApiOperation(value = "获取标准列表", response = StandardResultDetailModel.class, responseContainer = "List", notes = "获取标准列表")
    public List<StandardResultDetailModel> searchStandard(
            @ApiParam(name = "condition", value = "查询条件name:厂商、标准、标准版本名称,标准类别type:0为集成标准,1为应用标准")
            @RequestParam(value = "condition", required = false) String condition) {
        return standardService.getStandardList(condition);
    @ResponseBody
    public String searchStandard(String condition) throws Exception {
        String url = "/api/v1.0/standard_center/standards/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("condition", condition);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        return result;
    }
    /**
@ -42,11 +44,12 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getSysParamList")
    @ApiOperation(value = "获取集成标准系统参数", response = String.class, notes = "获取集成标准系统参数")
    public String getSysParamList() {
        List<Object[]> list = standardService.getSysParamList();
        String code = StringUtil.toString(list.get(0)[0]);
        return code;
    @ResponseBody
    public String getSysParamList() throws Exception {
        String url = "/api/v1.0/standard_center/standards/sysparam";
        Map<String, Object> params = new HashMap<String, Object>();
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        return result;
    }
@ -57,11 +60,13 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getForStandardId")
    @ApiOperation(value = "获取标准", response = StandardModel.class, produces = "application/json", notes = "获取标准")
    public StandardModel getForStandardId(
            @ApiParam(name = "standardId", value = "标准ID")
            @RequestParam(value = "standardId") Integer standardId){
        return standardService.get(standardId);
    @ResponseBody
    public String getForStandardId(Integer standardId) throws Exception {
        String url = "/api/v1.0/standard_center/standard";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standardId",standardId);
        String result = HttpClientUtil.doGet( host+url,params,username,password);
        return result;
    }
    /**
@ -71,11 +76,13 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/updateStandard")
    @ApiOperation(value = "修改标准", response = StandardModel.class, produces = "application/json", notes = "修改标准")
    public StandardModel modify(
            @ApiParam(name = "standard", value = "标准基本信息")
            @RequestParam(value = "standard") String standard) {
        return standardService.update(standard);
    @ResponseBody
    public String updateStandard(String standard) throws Exception {
        String url = "/api/v1.0/standard_center/standard";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standard",standard);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -85,11 +92,13 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/addStandard")
    @ApiOperation(value = "保存标准", response = StandardModel.class, produces = "application/json", notes = "保存标准")
    public StandardModel add(
            @ApiParam(name = "standard", value = "标准基本信息")
            @RequestParam(value = "standard") String standard) {
        return (StandardModel) standardService.add(standard);
    @ResponseBody
    public String addStandard(String standard) throws Exception {
        String url = "/api/v1.0/standard_center/standard";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standard",standard);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -99,10 +108,13 @@ public class StandardController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/deleteStandard")
    @ApiOperation(value = "删除标准", produces = "application/json", notes = "删除标准")
    public void delete(
            @ApiParam(name = "standardId", value = "标准ID")
            @RequestParam(value = "standardId") Integer standardId) {
        standardService.delete(standardId);
    @ResponseBody
    public String deleteStandard(Integer standardId) throws Exception {
        String url = "/api/v1.0/standard_center/standard";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standardId",standardId);
        String result = HttpClientUtil.doDelete(host + url, params, username, password);
        return result;
    }
}

+ 61 - 57
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StandardVersionController.java

@ -2,29 +2,30 @@ package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.model.DictItem;
import com.yihu.ehr.framework.model.DictionaryResult;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.standard.model.standard.StandardVersionModel;
import com.yihu.ehr.standard.service.standard.StandardVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("StandardVersionController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StandardVersionController", description = "标准版本管理", tags = {"标准版本"})
public class StandardVersionController extends BaseController {
    @Resource(name = StandardVersionService.BEAN_ID)
    private StandardVersionService standardVersionService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 根据版本id获取标准版本信息(get)
     * @param versionId
@ -32,11 +33,13 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getForVersionId")
    @ApiOperation(value = "获取标准版本", response = StandardVersionModel.class, produces = "application/json", notes = "获取标准版本")
    public StandardVersionModel getForVersionId(
            @ApiParam(name = "versionId", value = "标准版本ID")
            @RequestParam(value = "versionId") Integer versionId) {
        return standardVersionService.get(versionId);
    @ResponseBody
    public String getForVersionId(String versionId) throws Exception {
        String url = "/api/v1.0/standard_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",Integer.parseInt(versionId));
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        return result;
    }
    /**
@ -46,11 +49,13 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/addVersion")
    @ApiOperation(value = "保存标准版本", response = StandardVersionModel.class, produces = "application/json", notes = "保存标准版本")
    public StandardVersionModel addVersion(
            @ApiParam(name = "version", value = "标准版本信息")
            @RequestParam(value = "version") String version) {
        return (StandardVersionModel) standardVersionService.add(version);
    @ResponseBody
    public String addVersion(String version) throws Exception {
        String url = "/api/v1.0/standard_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -60,11 +65,13 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/updateVersion")
    @ApiOperation(value = "修改版本", response = StandardVersionModel.class, produces = "application/json", notes = "修改版本")
    public StandardVersionModel updateVersion(
            @ApiParam(name = "version", value = "标准版本")
            @RequestParam(value = "version") String version) {
        return standardVersionService.update(version);
    @ResponseBody
    public String updateVersion(String version) throws Exception {
        String url = "/api/v1.0/standard_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("version",version);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    /**
@ -75,13 +82,14 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/publishVersion")
    @ApiOperation(value = "发布版本", response = StandardVersionModel.class, produces = "application/json", notes = "发布版本")
    public StandardVersionModel publish(
            @ApiParam(name = "versionId", value = "标准版本ID")
            @RequestParam(value = "versionId") Integer versionId,
            @ApiParam(name = "publisher", value = "发布者")
            @RequestParam(value = "publisher") String publisher) {
        return standardVersionService.publish(versionId, publisher);
    @ResponseBody
    public String publishVersion(Integer versionId,String publisher) throws Exception {
        String url = "/api/v1.0/standard_center/version/publish";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        params.put("publisher",publisher);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    /**
@ -91,13 +99,14 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/deleteVersion")
    @ApiOperation(value = "删除版本", produces = "application/json", notes = "删除版本")
    public void delete(
            @ApiParam(name = "versionId", value = "标准版本ID")
            @RequestParam(value = "versionId") Integer versionId,
            @ApiParam(name = "version", value = "标准版本值")
            @RequestParam(value = "version") String version) {
        standardVersionService.delete(versionId,version);
    @ResponseBody
    public String deleteVersion(Integer versionId,String version) throws Exception {
        String url = "/api/v1.0/standard_center/version";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("versionId",versionId);
        params.put("version",version);
        String result = HttpClientUtil.doDelete(host + url, params, username, password);
        return result;
    }
    /**
@ -107,29 +116,24 @@ public class StandardVersionController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getVersions")
    @ApiOperation(value = "获取标准版本列表", response = DictionaryResult.class, produces = "application/json", notes = "获取标准版本列表")
    public DictionaryResult getVersions(
            @ApiParam(name = "standardId", value = "标准ID")
            @RequestParam(value = "standardId") Integer standardId,
            @ApiParam(name = "condition", value = "Must be Json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Must be Json")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StandardVersionModel> standardVersionModelList = standardVersionService.getList(standardId, condition, order, rows, page - 1);
    @ResponseBody
    public DictionaryResult getVersions(Integer standardId) throws Exception {
        String url = "/api/v1.0/standard_center/versions";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("standardId",standardId);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        DictItem item = new DictItem();
        item.setCode("");
        item.setValue("-无-");
        detailModelList.add(item);
        for (StandardVersionModel standardVersionModel : standardVersionModelList) {
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            String  id = standardVersionModel.getVersion();
            String name = standardVersionModel.getName();
            String  id = (String) jsonObject.get("version");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(name);
            detailModelList.add(items);

+ 70 - 70
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDatasetController.java

@ -1,20 +1,17 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.framework.util.operator.StringUtil;
import com.yihu.ehr.standard.model.Select2;
import com.yihu.ehr.standard.model.standard.StdDataSetModel;
import com.yihu.ehr.standard.service.standard.StdDatasetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.standard.model.StdDataSetModel;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -22,12 +19,13 @@ import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("StdDatasetController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StdDatasetController", description = "标准数据集管理", tags = {"标准数据集"})
public class StdDatasetController extends BaseController {
    @Resource(name = StdDatasetService.BEAN_ID)
    private StdDatasetService stdDatasetService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询数据集列表信息(get)
     * @param stdVersion
@ -39,20 +37,22 @@ public class StdDatasetController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchDatasetList")
    @ApiOperation(value = "获取数据集列表", response = Result.class, produces = "application/json", notes = "获取数据集列表")
    public Result searchDatasetList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "condition", value = "查询条件:编码或名称")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StdDataSetModel> dataSetModelList = stdDatasetService.getDatasetList(StdDataSetModel.class, stdVersion, condition, order, rows, page - 1);
        Integer count = stdDatasetService.getDatasetInt(StdDataSetModel.class, stdVersion, condition);
    @ResponseBody
    public Result searchDatasetList(String stdVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/standard_center/datasets/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<StdDataSetModel> dataSetModelList = jsonArrayToList(resultStr, StdDataSetModel.class);
        url = "/api/v1.0/standard_center/datasets/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(dataSetModelList);
        result.setTotalCount(count);
@ -60,60 +60,52 @@ public class StdDatasetController extends BaseController {
    }
    @RequestMapping("/getForDatasetId")
    @ApiOperation(value = "获取数据集", response = StdDataSetModel.class, produces = "application/json", notes = "获取数据集")
    public StdDataSetModel getForDatasetId(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "datasetId", value = "数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId) {
        return stdDatasetService.get(stdVersion, datasetId);
    @ResponseBody
    public String getForDatasetId(String stdVersion, Integer datasetId) throws Exception {
        String url = "/api/v1.0/standard_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("datasetId", datasetId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/delDataset")
    @ApiOperation(value = "删除数据集", produces = "application/json", notes = "删除数据集")
    public void delDataset(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "datasetId", value = "数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId) {
        stdDatasetService.delete(stdVersion, datasetId);
    @ResponseBody
    public String delDataset(String stdVersion, Integer id) throws Exception {
        String url = "/api/v1.0/standard_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("datasetId", id);
        String result = HttpClientUtil.doDelete(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/updateDataset")
    @ApiOperation(value = "修改数据集", response = StdDataSetModel.class, produces = "application/json", notes = "修改数据集")
    public StdDataSetModel updateDataset(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dataset", value = "数据集")
            @RequestParam(value = "dataset") String dataset) {
        return (StdDataSetModel) stdDatasetService.update(stdVersion, dataset);
    @ResponseBody
    public String updateDataset(String stdVersion, String dataset) throws Exception {
        String url = "/api/v1.0/standard_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dataset", dataset);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/addDataset")
    @ApiOperation(value = "保存数据集", response = StdDataSetModel.class, produces = "application/json", notes = "保存数据集")
    public StdDataSetModel add(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dataset", value = "数据集")
            @RequestParam(value = "dataset") String dataset) {
        return stdDatasetService.add(stdVersion, dataset);
    @ResponseBody
    public String addDataset(String stdVersion, String dataset) throws Exception {
        String url = "/api/v1.0/standard_center/dataset";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dataset", dataset);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value="/getDatasetCodeValues")
    @ApiOperation(value = "获取数据集下拉框信息", response = Result.class, produces = "application/json", notes = "获取机构数据元下拉框信息")
    public Result getSelectList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "q", value = "数据集名称或编码", required = false)
            @RequestParam(value = "q", required = false) String q,
            @ApiParam(name = "initVal", value = "初始化数据集名称或编码", required = false)
            @RequestParam(value = "initVal", required = false) String initVal,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @ResponseBody
    public String getDatasetCodeValues(String stdVersion, String q,String initVal, String order, Integer rows) throws Exception {
        Map<String,String> condition = new HashMap<String,String>();
        if(!StringUtil.isEmpty(q)){
            condition.put("name", q);
@ -123,9 +115,17 @@ public class StdDatasetController extends BaseController {
            condition.put("initVal", initVal);//默认值
        }
        JSONObject jsonpObject = JSONObject.fromObject(condition);
        List<Select2> detailModelList = stdDatasetService.getDatasetSelectList(stdVersion, jsonpObject.toString(), order, rows, 0);
        String url = "/api/v1.0/standard_center/datasets/selectList";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("condition", jsonpObject.toString());
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", 0);
        String resultStr = HttpClientUtil.doGet(host+url,params,username,password);
        List<Select2> detailModelList = jsonArrayToList(resultStr, Select2.class);
        Result result = getResult(detailModelList, detailModelList.size(), 1, rows);
        return result;
        return result.toJson();
    }
}

+ 69 - 71
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDictController.java

@ -1,20 +1,17 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.framework.util.operator.StringUtil;
import com.yihu.ehr.standard.model.Select2;
import com.yihu.ehr.standard.model.standard.StdDictionaryModel;
import com.yihu.ehr.standard.service.standard.StdDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.standard.model.StdDictionaryModel;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -22,12 +19,13 @@ import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("StdDictController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StdDictController", description = "标准字典管理", tags = {"标准字典"})
public class StdDictController extends BaseController {
    @Resource(name = StdDictService.BEAN_ID)
    StdDictService stdDictService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询字典列表信息(get)
     * @param stdVersion
@ -39,20 +37,22 @@ public class StdDictController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchDictList")
    @ApiOperation(value = "获取字典列表", response = Result.class, produces = "application/json", notes = "获取字典列表")
    public Result getDictList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "condition", value = "查询条件:编码或名称")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StdDictionaryModel> dictModelList = stdDictService.getDictList(StdDictionaryModel.class, stdVersion, condition, order, rows, page - 1);
        Integer count = stdDictService.getDictInt(StdDictionaryModel.class, stdVersion, condition);
    @ResponseBody
    public Result searchDictList(String stdVersion,String condition,String order,Integer rows,Integer page) throws Exception {
        String url = "/api/v1.0/standard_center/dicts/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<StdDictionaryModel> dictModelList = jsonArrayToList(resultStr, StdDictionaryModel.class);
        url = "/api/v1.0/standard_center/dicts/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        Result result = new Result();
        result.setDetailModelList(dictModelList);
        result.setTotalCount(count);
@ -60,61 +60,52 @@ public class StdDictController extends BaseController {
    }
    @RequestMapping("/getForDictId")
    @ApiOperation(value = "获取字典", response = StdDictionaryModel.class, produces = "application/json", notes = "获取字典")
    public StdDictionaryModel get(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictId", value = "字典ID")
            @RequestParam(value = "dictId") Integer dictId) {
        return stdDictService.get(stdVersion, dictId);
    @ResponseBody
    public String getForDictId(String stdVersion, Integer dictId) throws Exception {
        String url = "/api/v1.0/standard_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictId", dictId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/delDict")
    @ApiOperation(value = "删除字典", produces = "application/json", notes = "删除字典")
    public void delete(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictId", value = "字典ID")
            @RequestParam(value = "dictId") Integer dictId) {
        stdDictService.delete(stdVersion, dictId);
    @ResponseBody
    public boolean delDict(String stdVersion, Integer id) throws Exception {
        String url = "/api/v1.0/standard_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictId", id);
         HttpClientUtil.doDelete(host+url,params,username,password);
        return true;
    }
    
    @RequestMapping("/updateDict")
    @ApiOperation(value = "修改字典", response = StdDictionaryModel.class, produces = "application/json", notes = "修改字典")
    public StdDictionaryModel modify(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dict", value = "字典")
            @RequestParam(value = "dict") String dict) {
        return (StdDictionaryModel) stdDictService.update(stdVersion, dict);
    @ResponseBody
    public String updateDict(String stdVersion, String dict) throws Exception {
        String url = "/api/v1.0/standard_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dict", dict);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/addDict")
    @ApiOperation(value = "保存字典", response = StdDictionaryModel.class, produces = "application/json", notes = "保存字典")
    public StdDictionaryModel addDict(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dict", value = "字典")
            @RequestParam(value = "dict") String dict) {
        return (StdDictionaryModel) stdDictService.add(stdVersion, dict);
    @ResponseBody
    public String addDict(String stdVersion, String dict) throws Exception {
        String url = "/api/v1.0/standard_center/dict";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dict", dict);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value="/getDictCodeValues")
    @ApiOperation(value = "获取字典下拉框信息", response = String.class, produces = "application/json", notes = "获取字典下拉框信息")
    public String getSelectList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "q", value = "数据集名称或编码", required = false)
            @RequestParam(value = "q", required = false) String q,
            @ApiParam(name = "initVal", value = "初始化数据集名称或编码", required = false)
            @RequestParam(value = "initVal", required = false) String initVal,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @ResponseBody
    public String getDictCodeValues(String stdVersion, String q, String initVal, String order, Integer rows) throws Exception {
        Map<String,String> condition = new HashMap<String,String>();
        if(!StringUtil.isEmpty(q)){
            condition.put("name", q);
@ -123,8 +114,15 @@ public class StdDictController extends BaseController {
            condition.put("initVal", initVal);//默认值
        }
        JSONObject jsonpObject = JSONObject.fromObject(condition);
        List<StdDictionaryModel> dictList = stdDictService.getDictList(StdDictionaryModel.class, stdVersion, jsonpObject.toString(), order, rows, 0);
        List<Select2> detailModelList = stdDictService.getDictSelectList(dictList);
        String url = "/api/v1.0/standard_center/dicts/selectList";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("condition", jsonpObject.toString());
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", 0);
        String resultStr = HttpClientUtil.doGet(host+url,params,username,password);
        List<Select2> detailModelList = jsonArrayToList(resultStr, Select2.class);
        Result result = getResult(detailModelList, detailModelList.size(), 1, rows);
        return result.toJson();

+ 74 - 76
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdDictEntryController.java

@ -1,20 +1,17 @@
package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.framework.util.operator.StringUtil;
import com.yihu.ehr.standard.model.Select2;
import com.yihu.ehr.standard.model.standard.StdDictionaryEntryModel;
import com.yihu.ehr.standard.service.standard.StdDictEntryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.standard.model.StdDictionaryEntryModel;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -22,12 +19,13 @@ import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("StdDictEntryController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StdDictEntryController", description = "标准字典项管理", tags = {"标准字典项"})
public class StdDictEntryController extends BaseController {
    @Resource(name = StdDictEntryService.BEAN_ID)
    StdDictEntryService stdDictEntryService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询字典项列表信息(get)
     * @param stdVersion
@ -40,89 +38,80 @@ public class StdDictEntryController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchDictEntryList")
    @ApiOperation(value = "获取字典项列表", response = StdDictionaryEntryModel.class, responseContainer = "List",produces = "application/json", notes = "获取字典项列表")
    public Result getDictEntryList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictId", value = "字典ID")
            @RequestParam(value = "dictId") Integer dictId,
            @ApiParam(name = "condition", value = "查询条件")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @ResponseBody
    public Result searchDictEntryList(String stdVersion,Integer dictId,String condition,String order,Integer rows,Integer page) throws Exception {
        Result result = new Result();
        if(dictId==null){//没有字典数据时,返回空数据
            return result;
        }
        List<StdDictionaryEntryModel> detailModelList = stdDictEntryService.getDictEntryList(StdDictionaryEntryModel.class, stdVersion, dictId, condition, order, rows, page - 1);
        Integer count = stdDictEntryService.getDictEntryInt(StdDictionaryEntryModel.class, stdVersion, dictId, condition, order, rows, page - 1);
        String url = "/api/v1.0/standard_center/dictEntrys/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictId", dictId);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<StdDictionaryEntryModel> detailModelList = jsonArrayToList(resultStr, StdDictionaryEntryModel.class);
        url = "/api/v1.0/standard_center/dictEntrys/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        result.setDetailModelList(detailModelList);
        result.setTotalCount(count);
        return result;
    }
    @RequestMapping("/getForDictEntryId")
    @ApiOperation(value = "获取字典", response = StdDictionaryEntryModel.class, produces = "application/json", notes = "获取字典")
    public StdDictionaryEntryModel get(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictEntryId", value = "字典ID")
            @RequestParam(value = "dictEntryId") Integer dictEntryId) {
        return stdDictEntryService.get(stdVersion, dictEntryId);
    @ResponseBody
    public String getForDictEntryId(String stdVersion, Integer dictId, Integer dictEntryId) throws Exception {
        String url = "/api/v1.0/standard_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictId", dictId);
        params.put("dictEntryId", dictEntryId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/delDictEntry")
    @ApiOperation(value = "删除字典", produces = "application/json", notes = "删除字典")
    public void delete(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictEntryId", value = "字典ID")
            @RequestParam(value = "dictEntryId") Integer dictEntryId) {
        stdDictEntryService.delete(stdVersion, dictEntryId);
    @ResponseBody
    public boolean delDictEntry(String stdVersion, Integer id) throws Exception {
        String url = "/api/v1.0/standard_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictEntryId", id);
        HttpClientUtil.doDelete( host+url,params,username,password);
        return true;
    }
    @RequestMapping("/updateDictEntry")
    @ApiOperation(value = "修改字典", response = StdDictionaryEntryModel.class, produces = "application/json", notes = "修改字典")
    public StdDictionaryEntryModel modify(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictEntry", value = "字典")
            @RequestParam(value = "dictEntry") String dictEntry) {
        return (StdDictionaryEntryModel) stdDictEntryService.update(stdVersion, dictEntry);
    @ResponseBody
    public String updateDictEntry(String stdVersion, String dictEntry) throws Exception {
        String url = "/api/v1.0/standard_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictEntry", dictEntry);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/addDictEntry")
    @ApiOperation(value = "保存字典", response = StdDictionaryEntryModel.class, produces = "application/json", notes = "保存字典")
    public StdDictionaryEntryModel add(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictEntry", value = "字典")
            @RequestParam(value = "dictEntry") String dictEntry) {
        return (StdDictionaryEntryModel) stdDictEntryService.add(stdVersion, dictEntry);
    @ResponseBody
    public String addDictEntry(String stdVersion, String dictEntry) throws Exception {
        String url = "/api/v1.0/standard_center/dictEntry";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictEntry", dictEntry);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value="/getDictEntryCodeValues")
    @ApiOperation(value = "获取字典下拉框信息", response = Result.class, produces = "application/json", notes = "获取适配字典下拉框信息")
    public Result searchOrgDictItem(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "dictId", value = "数据集ID")
            @RequestParam(value = "dictId") Integer dictId,
            @ApiParam(name = "q", value = "字典名称或编码", required = false)
            @RequestParam(value = "q", required = false) String q,
            @ApiParam(name = "initDictValue", value = "初始化字典名称或编码", required = false)
            @RequestParam(value = "initDictValue", required = false) String initDictValue,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @ResponseBody
    public String getDictEntryCodeValues(String stdVersion, Integer dictId, String q, String initDictValue, String order, Integer rows) throws Exception {
        Map<String,String> condition = new HashMap<String,String>();
        if (StringUtil.isEmpty(initDictValue)) {
            initDictValue = "";
@ -133,9 +122,18 @@ public class StdDictEntryController extends BaseController {
            condition.put("name", q);
        }
        JSONObject jsonpObject = JSONObject.fromObject(condition);
        List<StdDictionaryEntryModel> dictEntryModelList = stdDictEntryService.getDictEntryList(StdDictionaryEntryModel.class, stdVersion, dictId, jsonpObject.toString(), order, rows, 0);
        List<Select2> detailModelList = stdDictEntryService.getDictEntrySelectList(dictEntryModelList);
        String url = "/api/v1.0/standard_center/dictEntrys/selectList";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("dictId", dictId);
        params.put("condition", jsonpObject.toString());
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", 0);
        String resultStr = HttpClientUtil.doGet(host+url,params,username,password);
        List<Select2> detailModelList = jsonArrayToList(resultStr, Select2.class);
        Result result = getResult(detailModelList, detailModelList.size(), 1, rows);
        return result;
        return result.toJson();
    }
}

+ 88 - 98
Hos-resource/src/main/java/com/yihu/ehr/standard/controller/StdMetadataController.java

@ -3,22 +3,18 @@ package com.yihu.ehr.standard.controller;
import com.yihu.ehr.framework.constrant.Result;
import com.yihu.ehr.framework.model.DictItem;
import com.yihu.ehr.framework.model.DictionaryResult;
import com.yihu.ehr.framework.util.ResourceProperties;
import com.yihu.ehr.framework.util.controller.BaseController;
import com.yihu.ehr.framework.util.httpclient.HttpClientUtil;
import com.yihu.ehr.framework.util.operator.StringUtil;
import com.yihu.ehr.standard.model.Select2;
import com.yihu.ehr.standard.model.standard.StdDictionaryModel;
import com.yihu.ehr.standard.model.standard.StdMetaDataModel;
import com.yihu.ehr.standard.service.standard.StdDictService;
import com.yihu.ehr.standard.service.standard.StdMetadataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.yihu.ehr.standard.model.StdMetaDataModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -27,14 +23,13 @@ import java.util.Map;
/**
 * Created by LLH on 2016/1/6.
 */
@RestController("StdMetadataController")
@Controller
@RequestMapping("/standardCenter")
@Api(protocols = "https", value = "StdMetadataController", description = "标准数据元管理", tags = {"标准数据元"})
public class StdMetadataController extends BaseController {
    @Resource(name = StdMetadataService.BEAN_ID)
    StdMetadataService stdMetadataService;
    @Resource(name = StdDictService.BEAN_ID)
    StdDictService stdDictService;
    private static   String host = "http://"+ ResourceProperties.getProperty("serverip")+":"+ResourceProperties.getProperty("port");
    private static   String username = ResourceProperties.getProperty("username");
    private static   String password = ResourceProperties.getProperty("password");
    /**
     * 查询数据元列表信息(get)
     * @param stdVersion
@ -47,89 +42,80 @@ public class StdMetadataController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/searchMetadataList")
    @ApiOperation(value = "获取数据元列表", response = Result.class, produces = "application/json", notes = "获取数据元列表")
    public Result getMetadataList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "datasetId", value = "数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId,
            @ApiParam(name = "condition", value = "查询条件")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StdMetaDataModel> metadataModelList = stdMetadataService.getMetadataList(StdMetaDataModel.class, stdVersion, datasetId, condition, order, rows, page - 1);
        Integer count = stdMetadataService.getMetadataCount(StdMetaDataModel.class, stdVersion, datasetId, condition);
    @ResponseBody
    public Result searchMetadataList(String stdVersion,Integer datasetId,String condition,String order,Integer rows,Integer page) throws Exception {
        Result result = new Result();
        if(datasetId==null){//没有数据集数据时,返回空数据
            return result;
        }
        String url = "/api/v1.0/standard_center/metadatas/list";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("datasetId", datasetId);
        params.put("condition", condition);
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", page - 1);
        String resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        List<StdMetaDataModel> metadataModelList = jsonArrayToList(resultStr, StdMetaDataModel.class);
        url = "/api/v1.0/standard_center/metadatas/totalCount";
        resultStr = HttpClientUtil.doGet(host+url, params, username, password);
        Integer count = Integer.parseInt(resultStr);
        result.setDetailModelList(metadataModelList);
        result.setTotalCount(count);
        return result;
    }
    @RequestMapping("/getForMetadataId")
    @ApiOperation(value = "获取数据元", response = StdMetaDataModel.class, produces = "application/json", notes = "获取数据元")
    public StdMetaDataModel getForMetadataId(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "metadataId", value = "数据元ID")
            @RequestParam(value = "metadataId") Integer metadataId) {
        return stdMetadataService.get(stdVersion, metadataId);
    @ResponseBody
    public String getForMetadataId(String stdVersion, Integer datasetId, Integer metadataId) throws Exception {
        String url = "/api/v1.0/standard_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("datasetId", datasetId);
        params.put("metadataId", metadataId);
        String result = HttpClientUtil.doGet(host+url,params,username,password);
        return result;
    }
    @RequestMapping("/delMetaData")
    @ApiOperation(value = "删除数据元", produces = "application/json", notes = "删除数据元")
    public void delMetaData(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "metadataId", value = "数据元ID")
            @RequestParam(value = "metadataId") Integer metadataId) {
        stdMetadataService.delete(stdVersion, metadataId);
    @ResponseBody
    public boolean delMetaData(String stdVersion, Integer id) throws Exception {
        String url = "/api/v1.0/standard_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("metadataId", id);
        HttpClientUtil.doDelete( host+url,params,username,password);
        return true;
    }
    @RequestMapping("/updateMetadata")
    @ApiOperation(value = "修改数据元", response = StdMetaDataModel.class, produces = "application/json", notes = "修改数据元")
    public StdMetaDataModel updateMetadata(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "metadata", value = "数据元")
            @RequestParam(value = "metadata") String metadata) {
        return stdMetadataService.update(stdVersion, metadata);
    @ResponseBody
    public String updateMetadata(String stdVersion, String metadata) throws Exception {
        String url = "/api/v1.0/standard_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("metadata", metadata);
        String result = HttpClientUtil.doPut(host + url, params, username, password);
        return result;
    }
    @RequestMapping("/addMetadata")
    @ApiOperation(value = "保存数据元", response = StdMetaDataModel.class, produces = "application/json", notes = "保存数据元")
    public StdMetaDataModel addMetadata(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "metadata", value = "数据元")
            @RequestParam(value = "metadata") String metadata) {
        return (StdMetaDataModel) stdMetadataService.add(stdVersion, metadata);
    @ResponseBody
    public String addMetadata(String stdVersion, String metadata) throws Exception {
        String url = "/api/v1.0/standard_center/metadata";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("metadata", metadata);
        String result = HttpClientUtil.doPost(host + url, params, username, password);
        return result;
    }
    @RequestMapping(value="/getMetadataCodeValues")
    @ApiOperation(value = "获取数据元下拉框信息", response = String.class, produces = "application/json", notes = "获取机构数据元下拉框信息")
    public String getSelectList(
            @ApiParam(name = "stdVersion", value = "标准版本号")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "datasetId", value = "数据集ID")
            @RequestParam(value = "datasetId") Integer datasetId,
            @ApiParam(name = "q", value = "数据元名称或编码", required = false)
            @RequestParam(value = "q", required = false) String q,
            @ApiParam(name = "initMetadataNm", value = "初始化数据元名称或编码", required = false)
            @RequestParam(value = "initMetadataNm", required = false) String initMetadataNm,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
    @ResponseBody
    public String getMetadataCodeValues(String stdVersion, Integer datasetId, String q, String initMetadataNm, String order, Integer rows) throws Exception {
        Map<String,String> condition = new HashMap<String,String>();
        if (StringUtil.isEmpty(initMetadataNm)) {
            initMetadataNm = "";
@ -140,8 +126,17 @@ public class StdMetadataController extends BaseController {
            condition.put("name", q);
        }
        JSONObject jsonpObject = JSONObject.fromObject(condition);
        List<StdMetaDataModel> metadataList = stdMetadataService.getMetadataList(StdMetaDataModel.class, stdVersion, datasetId, jsonpObject.toString(), order, rows, 0);
        List<Select2> detailModelList = stdMetadataService.getMetadataSelectList(metadataList);
        String url = "/api/v1.0/standard_center/metadatas/selectList";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion", stdVersion);
        params.put("datasetId", datasetId);
        params.put("condition", jsonpObject.toString());
        params.put("order", order);
        params.put("limit", rows);
        params.put("offset", 0);
        String resultStr = HttpClientUtil.doGet(host+url,params,username,password);
        List<Select2> detailModelList = jsonArrayToList(resultStr, Select2.class);
        Result result = getResult(detailModelList, detailModelList.size(), 1, rows);
        return result.toJson();
    }
@ -153,29 +148,24 @@ public class StdMetadataController extends BaseController {
     * @throws Exception
     */
    @RequestMapping("/getDicts")
    @ApiOperation(value = "获取字典列表", response = DictionaryResult.class, produces = "application/json", notes = "获取字典列表")
    public DictionaryResult getList(
            @ApiParam(name = "stdVersion", value = "stdVersion")
            @RequestParam(value = "stdVersion") String stdVersion,
            @ApiParam(name = "condition", value = "Must be Json")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Must be Json")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        List<StdDictionaryModel> stdDictionaryModelList = stdDictService.getList(stdVersion, condition, order, rows, page - 1);
    @ResponseBody
    public DictionaryResult getDicts(String stdVersion) throws Exception {
        String url = "/api/v1.0/standard_center/dicts";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("stdVersion",stdVersion);
        String result = HttpClientUtil.doGet(host + url, params, username, password);
        JSONArray array = JSONArray.fromObject(result);
        DictionaryResult dictionaryResult = new DictionaryResult();
        List<DictItem> detailModelList = new ArrayList<DictItem>();
        DictItem item = new DictItem();
        item.setCode("");
        item.setValue("-无-");
        detailModelList.add(item);
        for (StdDictionaryModel stdDictionaryModel : stdDictionaryModelList) {
        for(int i = 0; i < array.size(); i++){
            JSONObject jsonObject = array.getJSONObject(i);
            DictItem items = new DictItem();
            Integer  id = stdDictionaryModel.getId();
            String name = stdDictionaryModel.getName();
            Integer  id = (Integer) jsonObject.get("id");
            String name = (String)jsonObject.get("name");
            items.setCode(id.toString());
            items.setValue(name);
            detailModelList.add(items);

+ 1 - 18
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDatasetModel.java

@ -1,33 +1,16 @@
package com.yihu.ehr.standard.model.adapter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/16.
 */
public class AdapterDatasetModel {
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "increment")
    @Column(name = "id")
    private Integer id;
    @Column(name = "scheme_id")
    private Integer schemeId;
    @Column(name = "std_dataset_id")
    private Integer stdDatasetId;
    @Column(name = "std_dataset_code")
    private String stdDatasetCode;
    @Column(name = "std_dataset_name")
    private String stdDatasetName;
    @Column(name = "adapter_dataset_id")
    private Integer adapterDatasetId;
    @Column(name = "adapter_dataset_code")
    private String adapterDatasetCode;
    @Column(name = "adapter_dataset_name")
    private String adapterDatasetName;
    public Integer getId() {

+ 1 - 1
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/AdapterDictEntryResultDetailModel.java

@ -1,4 +1,4 @@
package com.yihu.ehr.standard.model.adapter.resultModel;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/16.

+ 1 - 18
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDictModel.java

@ -1,33 +1,16 @@
package com.yihu.ehr.standard.model.adapter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/16.
 */
public class AdapterDictModel {
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "increment")
    @Column(name = "id")
    private Integer id;
    @Column(name = "scheme_id")
    private Integer schemeId;
    @Column(name = "std_dict_id")
    private Integer stdDictId;
    @Column(name = "std_dict_code")
    private String stdDictCode;
    @Column(name = "std_dict_name")
    private String stdDictName;
    @Column(name = "adapter_dict_id")
    private Integer adapterDictId;
    @Column(name = "adapter_dict_code")
    private String adapterDictCode;
    @Column(name = "adapter_dict_name")
    private String adapterDictName;
    public Integer getId() {

+ 1 - 20
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/AdapterDictentryModel.java

@ -1,37 +1,18 @@
package com.yihu.ehr.standard.model.adapter;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/16.
 */
public class AdapterDictentryModel {
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "increment")
    @Column(name = "id")
    private Integer id;
    @Column(name = "scheme_id")
    private Integer schemeId;
    @Column(name = "std_dict_id")
    private Integer stdDictId;
    @Column(name = "std_entry_id")
    private Integer stdEntryId;
    @Column(name = "std_entry_code")
    private String stdEntryCode;
    @Column(name = "std_entry_value")
    private String stdEntryValue;
    @Column(name = "adapter_dict_id")
    private Integer adapterDictId;
    @Column(name = "adapter_entry_id")
    private Integer adapterEntryId;
    @Column(name = "adapter_entry_code")
    private String adapterEntryCode;
    @Column(name = "adapter_entry_value")
    private String adapterEntryValue;
    public Integer getId() {

+ 2 - 11
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/AdapterMetadataResultDetailModel.java

@ -1,9 +1,9 @@
package com.yihu.ehr.standard.model.adapter.resultModel;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/16.
 */
public class AdapterMetadataResultDetailModel {
public class AdapterMetadataModel {
    private Integer id;
    private Integer schemeId;
    private Integer stdDatasetId;
@ -16,7 +16,6 @@ public class AdapterMetadataResultDetailModel {
    private String adapterMetadataCode;
    private String adapterMetadataName;
    private Integer adapterDataType;
    private String adapterMetadataType;
    private Integer adapterDictId;
    public Integer getId() {
@ -122,12 +121,4 @@ public class AdapterMetadataResultDetailModel {
    public void setAdapterDictId(Integer adapterDictId) {
        this.adapterDictId = adapterDictId;
    }
    public String getAdapterMetadataType() {
        return adapterMetadataType;
    }
    public void setAdapterMetadataType(String adapterMetadataType) {
        this.adapterMetadataType = adapterMetadataType;
    }
}

+ 2 - 2
Hos-resource/src/main/java/com/yihu/ehr/standard/model/adapter/resultModel/ApiMetadataResultDetailModel.java

@ -1,7 +1,7 @@
package com.yihu.ehr.standard.model.adapter.resultModel;
package com.yihu.ehr.standard.model;
/**
 * Created by lingfeng on 2015/9/18.
 * Created by lingfeng on 2015/9/16.
 */
public class ApiMetadataResultDetailModel {
    private Integer id;

+ 3 - 28
Hos-resource/src/main/java/com/yihu/ehr/standard/model/standard/StandardModel.java

@ -1,8 +1,5 @@
package com.yihu.ehr.standard.model.standard;
package com.yihu.ehr.standard.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
/**
@ -10,38 +7,16 @@ import java.io.Serializable;
 *
 * @created Airhead 2015/12/23.
 */
@Entity
@Table(name = "std_info")
public class StandardModel  implements Serializable {
    public static final String TABLE_NAME = "STD_INFO";
    @Id
    @GenericGenerator(name = "generator", strategy = "")
    @Column(name = "id")
    private Integer id;
public class StandardModel implements Serializable {
    @Column(name = "name")
    private Integer id;
    private String name;
    @Column(name = "code")
    private String code;
    @Column(name = "publisher")
    private String publisher;
    @Column(name = "publisher_org_code")
    private String publisherOrgCode;
    @Column(name = "summary")
    private String summary;
    @Column(name = "ref_standard")
    private String refStandard;
    @Column(name = "ref_standard_version")
    private String refStandardVersion;
    @Column(name = "version_status")
    private Integer versionStatus;
    public StandardModel(){

+ 0 - 0
Hos-resource/src/main/java/com/yihu/ehr/standard/model/standard/resultModel/StandardResultDetailModel.java


Деякі файли не було показано, через те що забагато файлів було змінено