Prechádzať zdrojové kódy

Merge branch '2.0' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into 2.0

wangzhinan 1 rok pred
rodič
commit
0531db70b6
21 zmenil súbory, kde vykonal 560 pridanie a 65 odobranie
  1. 4 1
      business/base-service/src/main/java/com/yihu/jw/hospital/disease/service/BaseDiseaseHospitalService.java
  2. 190 1
      common/common-entity/src/db/sql记录
  3. 34 8
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServiceItemConfig.java
  4. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/FileResource.java
  5. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java
  6. 9 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  7. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageEndpoint.java
  8. 5 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageSubItemEndpoint.java
  9. 17 11
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServiceItemConfigService.java
  10. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageSubItemService.java
  11. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/resource/ReportController.java
  12. 35 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/config/jpa/HibernateProperties.java
  13. 59 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/config/jpa/WlyySpecialistJpa.java
  14. 1 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/controller/FileResourceEndPoint.java
  15. 2 1
      svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/XFileResourceRepository.java
  16. 2 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/FileResourceManager.java
  17. 10 7
      svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/controller/RsDictionaryEntryEndPoint.java
  18. 66 12
      svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/dao/ResourceBrowseDao.java
  19. 36 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/dao/ResourceBrowseMetadataDao.java
  20. 62 13
      svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/service/ResourceBrowseService.java
  21. 9 0
      svr/svr-basic/src/main/resources/application.yml

+ 4 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/disease/service/BaseDiseaseHospitalService.java

@ -131,7 +131,10 @@ public class BaseDiseaseHospitalService extends BaseJpaService<BaseDiseaseHospit
                "\tfamily_relation as familyRelation,\n" +
                "\tfamily_relation_name as familyRelationName,\n" +
                "\tdate_format(create_time ,'%Y-%m-%d %H:%i:%S' ) as createTime,\n" +
                "\tdate_format(update_time ,'%Y-%m-%d %H:%i:%S' ) as updateTime\n" +
                "\tdate_format(update_time ,'%Y-%m-%d %H:%i:%S' ) as updateTime ," +
                "\trehabilitation_type 'rehabilitationType'," +
                "\trehabilitation_down_type 'rehabilitationDownType'," +
                "\trehabilitation_template_id 'rehabilitationTemplateId'\n" +
                "FROM\n" +
                "\tbase_disease_hospital dh where 1=1 ";
        if (StringUtils.isNoneBlank(name)){

+ 190 - 1
common/common-entity/src/db/sql记录

@ -2154,4 +2154,193 @@ ALTER table base_daily_report_item add COLUMN `dept` varchar(50) DEFAULT NULL CO
ALTER table base_daily_report_item add COLUMN `dept_name` varchar(50) DEFAULT NULL COMMENT '部门名称';
-- 2023-02-27
base_patient_doctor 暂时用来代替 wlyy_sign_family
base_patient_doctor 暂时用来代替 wlyy_sign_family
==================================开始=======================================
-- 20231010 服务包康复模板
ALTER TABLE `base`.`wlyy_rehabilitation_plan_template`
ADD COLUMN `disease_id` varchar(50) NULL COMMENT '病种code' AFTER `update_time`,
ADD COLUMN `disease_name` varchar(50) NULL COMMENT '病种name' AFTER `update_time`,
ADD COLUMN `status` varchar(10) NULL COMMENT '状态是否生效' AFTER `disease_id`;
ALTER TABLE `base`.`wlyy_rehabilitation_plan_template`
ADD COLUMN `type` varchar(255) NULL COMMENT 'template表示模板,plan表示计划' AFTER `status`;
ALTER TABLE `base`.`wlyy_rehabilitation_template_detail`
ADD COLUMN `assess_type` varchar(10) NULL COMMENT '项目评价' AFTER `expense`,
ADD COLUMN `booking_type` varchar(10) NULL COMMENT '是否预约' AFTER `assess_type`,
ADD COLUMN `late_serve_type` varchar(10) NULL COMMENT '是否运行逾期服务' AFTER `booking_type`,
ADD COLUMN `plan_start_time_type` varchar(10) NULL COMMENT '计划开始时间类型' AFTER `late_serve_type`,
ADD COLUMN `server_time_type` varchar(10) NULL COMMENT '服务方法' AFTER `plan_start_time_type`,
ADD COLUMN `server_count` varchar(10) NULL COMMENT '服务次数' AFTER `server_time_type`,
ADD COLUMN `pricing_units_code` varchar(10) NULL COMMENT '计价单位' AFTER `server_count`;
ADD COLUMN `pricing_units_name` varchar(10) NULL COMMENT '计价单位名称' AFTER `pricing_units_name`;
ALTER TABLE `base`.`base_service_package_item`
ADD COLUMN `leased_code` varchar(100) NULL COMMENT '租户code' AFTER `topic_item`,
ADD COLUMN `leased_name` varchar(50) NULL COMMENT '租户name' AFTER `leased_code`,
ADD COLUMN `sub_item_type` varchar(10) NULL COMMENT '是否包含子项目' AFTER `leased_name`;
ALTER TABLE `base`.`base_service_package_item`
ADD COLUMN `template_type` varchar(20) NULL COMMENT '模板的类型-目前是随访为1' AFTER `sub_item_type`,
ADD COLUMN `template_code` varchar(255) NULL COMMENT '对应模板的id' AFTER `template_type`;
CREATE TABLE `base`.`base_service_item_config`  (
  `id` varchar(100) NOT NULL COMMENT '主键',
  `package_id` varchar(100) NULL COMMENT '服务包id',
  `server_item_id` varchar(100) NULL COMMENT '服务项id',
  `assess_type` varchar(100) NULL COMMENT '项目评价',
  `booking_type` varchar(100) NULL COMMENT '是否预约',
  `late_serve_type` varchar(100) NULL COMMENT '是否运行逾期服务',
  `plan_start_time_type` varchar(100) NULL COMMENT '计划开始时间类型',
  `server_time_type` varchar(100) NULL COMMENT '服务方法',
  `server_count` varchar(100) NULL COMMENT '服务次数',
  `template_type` varchar(100) NULL COMMENT '模板的类型-目前是随访为1',
  `template_code` varchar(100) NULL COMMENT '对应模板的id',
  PRIMARY KEY (`id`)
);
CREATE TABLE `template_json` (
  `id`  varchar(100)  NOT NULL COMMENT '主键',
  `template_id` varchar(100) DEFAULT NULL COMMENT '模板id',
  `template_name` varchar(50) DEFAULT NULL COMMENT '模板名称',
  `template_json` text COMMENT '模板json',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `create_user` varchar(255) DEFAULT NULL COMMENT '创建人',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
ALTER TABLE `base`.`base_service_package`
ADD COLUMN `leased_code` varchar(50) NULL COMMENT '租户code' AFTER `org_name`,
ADD COLUMN `leased_name` varchar(50) NULL COMMENT '租户name' AFTER `leased_code`,
ADD COLUMN `server_time_type` varchar(20) NULL COMMENT '服务时间类型' AFTER `leased_name`,
ADD COLUMN `server_time` varchar(50) NULL COMMENT '服务期限' AFTER `server_time_type`,
ADD COLUMN `server_time_description` varchar(255) NULL COMMENT '服务时间说明' AFTER `server_time`,
ADD COLUMN `create_user` varchar(50) NULL COMMENT '创建人code' AFTER `server_time_description`,
ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人name' AFTER `create_user`,
ADD COLUMN `update_user` varchar(50) NULL COMMENT '更新人code' AFTER `create_user_name`,
ADD COLUMN `update_user_name` varchar(50) NULL COMMENT '更新人name' AFTER `update_user`,
ADD COLUMN `update_time` datetime NULL COMMENT '更新时间' AFTER `create_time`;
CREATE TABLE `base`.`base_service_package_sub_item`  (
  `id` varchar(100) NOT NULL COMMENT '主键',
  `name` varchar(100) NULL COMMENT '名称',
  `item_id` varchar(100) NULL COMMENT '项目的id',
  `introduce` varchar(255) NULL COMMENT '说明',
  `status` varchar(10) NULL COMMENT '状态',
  `sort` varchar(10) NULL,
  `leased_code` varchar(100) NULL,
  `leased_name` varchar(100) NULL,
  `org_code` varchar(100) NULL COMMENT '机构code',
  `org_name` varchar(100) NULL COMMENT '机构name',
  `photo` varchar(100) NULL COMMENT '照片',
  `create_time` varchar(100) NULL COMMENT '照片',
  `create_time` datetime ;
  PRIMARY KEY (`id`)
);
ALTER TABLE `base`.`base_service_package_sub_item`
ADD COLUMN `item_id` varchar(100) NULL COMMENT '父项目id' AFTER `id`;
CREATE TABLE `base`.`base_service_package_item_relational`  (
  `id` varchar(100) NOT NULL COMMENT '主键',
  `item_id` varchar(100) NULL COMMENT '项目id',
  `sub_item_id` varchar(100) NULL COMMENT '子项目id',
  PRIMARY KEY (`id`)
);
CREATE TABLE `base`.`base_followup_template`  (
  `id` varchar(100) NOT NULL,
  `template_name` varchar(255) NULL,
  `followup_statrt_time_type` varchar(100) NULL,
  `followup_count` varchar(10) NULL,
  `description` varchar(255) NULL,
  `template_detail_json` text NULL,
  `status` varchar(10) NULL,
  `leased_code` varchar(100) NULL,
  `leased_name` varchar(100) NULL,
  `org_code` varchar(100) NULL,
  `org_name` varchar(255) NULL,
  `create_time` datetime NULL,
  `update_time` datetime NULL,
  `create_user` varchar(100) NULL,
  `create_user_name` varchar(100) NULL,
  `update_user` varchar(100) NULL,
  `update_user_name` varchar(100) NULL,
  PRIMARY KEY (`id`)
);
ALTER TABLE `base`.`base_disease_hospital`
ADD COLUMN `rehabilitation_type` varchar(100) NULL COMMENT '是否开通诊后康复 0否 1是' AFTER `sort`,
ADD COLUMN `rehabilitation_down_type` varchar(100) NULL COMMENT '康复下转 1自动 2手动' AFTER `rehabilitation_type`,
ADD COLUMN `rehabilitation_template_id` varchar(100) NULL COMMENT '康复计划模板id' AFTER `rehabilitation_down_type`;
ALTER TABLE `base`.`base_service_package_sub_item`
CHANGE COLUMN `item_id` `dict_item_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '字典配置的服务项的id' AFTER `id`;
ALTER TABLE `base`.`base_service_package_item`
ADD COLUMN `service_package_item_id` varchar(50) NULL COMMENT '创建服务项的id。也是本表的id。system那些数据' AFTER `service_package_id`;
ALTER TABLE `base`.`wlyy_rehabilitation_template_detail`
ADD COLUMN `template_type` varchar(100) NULL COMMENT '随访模板类型' AFTER `pricing_units_name`,
ADD COLUMN `template_code` varchar(100) NULL COMMENT '随访模板id' AFTER `template_type`;
ALTER TABLE `base`.`base_service_item_config`
ADD COLUMN `pricing_units_code` varchar(100) NULL COMMENT '计价单位' AFTER `template_code`,
ADD COLUMN `pricing_units_name` varchar(100) NULL COMMENT '计价单位名称' AFTER `pricing_units_code`;
ALTER TABLE `base`.`base_service_item_config`
ADD COLUMN `frequency_code` varchar(100) NULL COMMENT '频次' AFTER `pricing_units_name`;
====================================结束==============================================
====================================开始==============================================
-- 2023-10-10 康复下转
CREATE TABLE `wlyy_rehabilitation_patient_info` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `code` varchar(50) DEFAULT NULL,
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `idcard` varchar(50) DEFAULT NULL COMMENT '身份证',
  `sex` tinyint(2) DEFAULT NULL COMMENT '性别1男2女0未知',
  `age` tinyint(3) DEFAULT NULL COMMENT '年龄',
  `ssc` varchar(50) DEFAULT NULL COMMENT '社保卡',
  `mobile` varchar(50) DEFAULT NULL COMMENT '电话',
  `address` varchar(255) DEFAULT NULL COMMENT '住址',
  `kid` tinyint(2) DEFAULT NULL COMMENT '是否儿科:1是 0否,4岁以下儿童',
  `kid_parents` varchar(50) DEFAULT NULL COMMENT '患者家属',
  `diagnosis` varchar(50) DEFAULT NULL COMMENT '诊断code',
  `diagnosis_name` varchar(255) DEFAULT NULL COMMENT '出院诊断',
  `treatment` varchar(2000) DEFAULT NULL COMMENT '主要病情摘要及诊疗经过',
  `result` text COMMENT '出院前检查结果',
  `guidance` text COMMENT '后续治疗康复指导建议',
  `summary` varchar(2000) DEFAULT NULL COMMENT '出院小结',
  `crzq` varchar(100) DEFAULT NULL COMMENT '转诊日期',
  `hospital_code` varchar(50) DEFAULT NULL COMMENT '医院CODE',
  `hospital_name` varchar(100) DEFAULT NULL COMMENT '医院名称',
  `jw_hospital_code` varchar(50) DEFAULT NULL COMMENT '社区医院CODE',
  `jw_hospital_name` varchar(255) DEFAULT NULL COMMENT '社区医院名称',
  `hospital_doctor` varchar(255) DEFAULT NULL COMMENT '转诊医生',
  `create_time` datetime DEFAULT NULL COMMENT '请求时间',
  `status` int(11) DEFAULT NULL COMMENT '是否分配下转:0未分配,1已分配(已下转列表),2创建计划过程失败,3患者无住院病历信息(等待重新下转),4不支持该医院自动下转,5同步居民失败,6下转列表(未下转)',
  `problem_code` varchar(50) DEFAULT NULL COMMENT '问题代码1001肺癌,1002慢性胃肠病,1003冠心病,1004慢性前列腺疾病,1005慢性乳腺疾病,1006慢性阻塞性肺病,1007慢性肝病,1008慢性妇科炎症,1009脑卒中,1010慢性肾病',
  `diagnose_doctor` varchar(255) DEFAULT NULL COMMENT '诊断医生',
  `diagnose_time` datetime DEFAULT NULL COMMENT '诊断时间',
  `org_code` varchar(50) DEFAULT NULL COMMENT '接收社区医院code',
  `org_name` varchar(50) DEFAULT NULL COMMENT '接收社区医院名称',
  `doctor` varchar(50) DEFAULT NULL COMMENT '接收医生code',
  `doctor_name` varchar(50) DEFAULT NULL COMMENT '接收医生姓名',
  `receive_time` datetime DEFAULT NULL COMMENT '接收时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=150484 DEFAULT CHARSET=utf8mb4 COMMENT='出院小结的居民[需要下转居民信息]';
====================================结束==============================================

+ 34 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServiceItemConfig.java

@ -5,6 +5,8 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
@ -16,10 +18,10 @@ import java.util.Date;
public class ServiceItemConfig extends UuidIdentityEntity implements java.io.Serializable {
    @Column(name = "package_id")
    private String packageId;//名称
    private String packageId;//服务包id
    @Column(name = "server_item_id")
    private String serverItemId;//项目的id
    private String serverItemId;//项目的id-对应item表主键
    @Column(name = "assess_type")
    private String assessType;//说明
@ -36,8 +38,8 @@ public class ServiceItemConfig extends UuidIdentityEntity implements java.io.Ser
    @Column(name = "server_time_type")
    private String serverTimeType;
    @Column(name = "serverCount")
    private String server_count;
    @Column(name = "server_count")
    private String serverCount;
    @Column(name = "template_type")
    private String templateType;
@ -52,6 +54,30 @@ public class ServiceItemConfig extends UuidIdentityEntity implements java.io.Ser
    @Column(name = "pricing_units_name")
    private String pricingUnitsName;//计价单位名称
    @Column(name = "frequency_code")
    private String frequencyCode;//频次
    private String name;//名称
    @Transient
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getFrequencyCode() {
        return frequencyCode;
    }
    public void setFrequencyCode(String frequencyCode) {
        this.frequencyCode = frequencyCode;
    }
    public String getPricingUnitsCode() {
        return pricingUnitsCode;
    }
@ -124,12 +150,12 @@ public class ServiceItemConfig extends UuidIdentityEntity implements java.io.Ser
        this.serverTimeType = serverTimeType;
    }
    public String getServer_count() {
        return server_count;
    public String getServerCount() {
        return serverCount;
    }
    public void setServer_count(String server_count) {
        this.server_count = server_count;
    public void setServerCount(String serverCount) {
        this.serverCount = serverCount;
    }
    public String getTemplateType() {

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/FileResource.java

@ -1,4 +1,4 @@
package com.yihu.jw.basic.fileresource.service;
package com.yihu.jw.entity.ehr.fileresource;
import javax.persistence.*;
import java.util.Date;

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java

@ -44,8 +44,20 @@ public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperator
    @Column(name = "status")
    private String status;
    @Column(name = "type")
    private String type;
    //---------------------------------
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getStatus() {
        return status;
    }

+ 9 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -67,6 +67,12 @@ public class PostFilter extends ZuulFilter {
                url.contains("/open/noLogin/pushArticleCountExcel")||
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/servicePackageSubItem/exportSubItemExcel")|| //导出
                url.contains("/Funds/deviceInfoExcel")){
            return true;
        }
@ -149,6 +155,9 @@ public class PostFilter extends ZuulFilter {
                url.contains("/excelControl")||
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/servicePackageSubItem/exportSubItemExcel")|| //导出
                url.contains("/Funds/deviceInfoExcel"))){
            RequestContext.getCurrentContext().setResponseBody(object.toJSONString());
        }else {

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageEndpoint.java

@ -5,6 +5,7 @@ import com.yihu.jw.base.dao.servicePackage.ServicePackageDao;
import com.yihu.jw.base.dao.servicePackage.ServicePackageItemDao;
import com.yihu.jw.base.service.servicePackage.ServiceItemConfigService;
import com.yihu.jw.base.service.servicePackage.ServicePackageService;
import com.yihu.jw.entity.base.servicePackage.ServiceItemConfig;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.restmodel.qvo.ParamQvo;
@ -130,7 +131,7 @@ public class ServicePackageEndpoint extends EnvelopRestEndpoint {
        jsonStr = URLDecoder.decode(jsonStr, "UTF-8");
        System.out.println("入参:" + JSON.toJSONString(jsonStr));
        ParamQvo qvo = JSON.parseObject(jsonStr, ParamQvo.class);
        List<Map<String, Object>> list = itemConfigService.findItemConfig(qvo);
        List<ServiceItemConfig> list = itemConfigService.findItemConfig(qvo);
        return success("配置服务项计划成功", list);
    }

+ 5 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageSubItemEndpoint.java

@ -8,7 +8,6 @@ import com.yihu.jw.base.service.servicePackage.ServicePackageSubItemService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.vo.excel.SubItemExcelVo;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSubItemDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.restmodel.qvo.ParamQvo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -108,7 +107,7 @@ public class ServicePackageSubItemEndpoint extends EnvelopRestEndpoint {
     * 导入数据
     */
    @PostMapping(value = "/importSubItemExcel")
    public void importSubItemExcel(
    public Envelop importSubItemExcel(
            @ApiParam(value = "文件", required = true)
            @RequestParam(value = "file", required = true) MultipartFile file) {
        try {
@ -121,9 +120,11 @@ public class ServicePackageSubItemEndpoint extends EnvelopRestEndpoint {
                    .doReadSync();
            subItemService.importSubItemExcel(list);
            return success("导入成功!");
        } catch (Exception exception) {
            throw new RuntimeException(exception);
            System.out.println(exception);
//            throw new RuntimeException(exception);
            return failed("导入失败!");
        }
    }

+ 17 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServiceItemConfigService.java

@ -1,7 +1,6 @@
package com.yihu.jw.base.service.servicePackage;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.base.dao.servicePackage.ServiceItemConfigDao;
import com.yihu.jw.entity.base.servicePackage.ServiceItemConfig;
import com.yihu.jw.mysql.query.BaseJpaService;
@ -9,12 +8,12 @@ import com.yihu.jw.restmodel.qvo.ParamQvo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -36,31 +35,38 @@ public class ServiceItemConfigService extends BaseJpaService<ServiceItemConfig,
     * 保存服务项的配置
     */
    public void changeItemConfig(ParamQvo qvo) throws Exception {
//        ObjectMapper objectMapper = new ObjectMapper();
        String jsonContent = qvo.getJsonContent();
        ObjectMapper objectMapper = new ObjectMapper();
        //转换成数组
        List<ServiceItemConfig> itemConfigList = objectMapper.readValue(jsonContent, new TypeReference<List<ServiceItemConfig>>() {
        });
        List<ServiceItemConfig> itemConfigList = JSON.parseArray(jsonContent, ServiceItemConfig.class);
//        //转换成数组
//        List<ServiceItemConfig> itemConfigList = objectMapper.readValue(jsonContent, new TypeReference<List<ServiceItemConfig>>() {
//        });
        String collect = itemConfigList.stream().map(vo -> String.valueOf("'" + vo.getServerItemId() + "'"))
                .collect(Collectors.joining(",", "(", ") "));
        //删除服务项的配置
        String sql = " DELETE FROM base_service_item_config q WHERE q.package_id='" + qvo.getId() + "' AND q.server_item_id IN " + collect;
        jdbcTemplate.execute(sql);
        //保存
//        for (ServiceItemConfig config : itemConfigList) {
//            itemConfigDao.save(config);
//        }
        itemConfigDao.saveAll(itemConfigList);
    }
    public List<Map<String, Object>> findItemConfig(ParamQvo qvo) {
    public List<ServiceItemConfig> findItemConfig(ParamQvo qvo) {
        String sql = "SELECT\n" +
                "	b.name,a.* \n" +
                "FROM\n" +
                "	base_service_item_config a\n" +
                "	INNER JOIN base_service_package_item b ON a.package_id = b.service_package_id \n" +
                "	AND a.server_item_id = b.service_package_item_id\n" +
                "	AND a.server_item_id = b.id \n" +
                "	WHERE 1=1 AND a.package_id='" + qvo.getId() + "'";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<ServiceItemConfig> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ServiceItemConfig.class));
//        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageSubItemService.java

@ -81,10 +81,10 @@ public class ServicePackageSubItemService extends BaseJpaService<ServicePackageS
                " c.`name`'itemName',a.`name` 'subItemName' ,a.*\n" +
                "FROM\n" +
                " base_service_package_sub_item a\n" +
                " INNER JOIN base_service_package_item_relational b ON a.id = b.sub_item_id \n" +
                " INNER JOIN base_service_package_item c ON b.item_id=c.id\n" +
                " LEFT JOIN base_service_package_item_relational b ON a.id = b.sub_item_id \n" +
                " LEFT JOIN base_service_package_item c ON b.item_id=c.id\n" +
                "WHERE\n" +
                " 1 = 1;";
                " 1 = 1 ";
        if (StringUtils.isNotBlank(qvo.getId())) {
            detailSql += "AND a.id = '" + qvo.getId() + "'";
        }

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/agadmin/controller/resource/ReportController.java

@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.basic.agadmin.service.ReportService;
import com.yihu.jw.basic.agadmin.service.ResourceBrowseControllerService;
import com.yihu.jw.basic.fileresource.service.FileResource;
import com.yihu.jw.basic.fileresource.service.FileResourceManager;
import com.yihu.jw.basic.quota.service.TjDimensionMainService;
import com.yihu.jw.basic.quota.service.TjDimensionSlaveService;
@ -16,6 +15,7 @@ import com.yihu.jw.basic.resource.dao.RsReportDao;
import com.yihu.jw.basic.resource.model.RsCategoryTypeTreeModel;
import com.yihu.jw.basic.resource.service.*;
import com.yihu.jw.basic.util.FileUploadUtil;
import com.yihu.jw.entity.ehr.fileresource.FileResource;
import com.yihu.jw.entity.ehr.id.BizObject;
import com.yihu.jw.entity.ehr.quota.TjDimensionMain;
import com.yihu.jw.entity.ehr.quota.TjDimensionSlave;

+ 35 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/config/jpa/HibernateProperties.java

@ -0,0 +1,35 @@
package com.yihu.jw.basic.config.jpa;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Component
@RefreshScope
public class HibernateProperties {
    @Value("${hibernate.dialect}")
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
    @Value("${hibernate.physical_naming_strategy}")
    private String physical_naming_strategy;
    @Value("${hibernate.implicit_naming_strategy}")
    private String implicit_naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
//        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        properties.put("hibernate.physical_naming_strategy",physical_naming_strategy);
        properties.put("hibernate.implicit_naming_strategy",implicit_naming_strategy);
        return properties;
    }
}

+ 59 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/config/jpa/WlyySpecialistJpa.java

@ -0,0 +1,59 @@
package com.yihu.jw.basic.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * 开启sql打印
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyySpecialistEntityManagerFactory",
        transactionManagerRef = "wlyySpecialistTransactionManager",
        basePackages = {"com.yihu.jw.basic.*.dao","com.yihu.jw.restmodel.exception.dao","com.yihu.jw.util.dao"})   //设置Repository所在位置
public class WlyySpecialistJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "wlyySpecialistEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.jw.entity");
        emfb.setPersistenceUnitName("specialist");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
//        Properties properties = hibernateProperties.hibProperties();
//        properties.put("hibernate.ejb.naming_strategy","org.hibernate.cfg.ImprovedNamingStrategy");
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "wlyySpecialistTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("wlyySpecialistEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

+ 1 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/controller/FileResourceEndPoint.java

@ -1,9 +1,9 @@
package com.yihu.jw.basic.fileresource.controller;
import com.yihu.jw.basic.fileresource.service.FileResource;
import com.yihu.jw.basic.fileresource.service.FileResourceManager;
import com.yihu.jw.constants.ApiVersion;
import com.yihu.jw.entity.ehr.fileresource.FileResource;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.entity.ehr.id.BizObject;

+ 2 - 1
svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/XFileResourceRepository.java

@ -1,5 +1,6 @@
package com.yihu.jw.basic.fileresource.service;
package com.yihu.jw.basic.fileresource.dao;
import com.yihu.jw.entity.ehr.fileresource.FileResource;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;

+ 2 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/fileresource/service/FileResourceManager.java

@ -2,6 +2,8 @@ package com.yihu.jw.basic.fileresource.service;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.basic.fileresource.dao.XFileResourceRepository;
import com.yihu.jw.entity.ehr.fileresource.FileResource;
import com.yihu.jw.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

+ 10 - 7
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/controller/RsDictionaryEntryEndPoint.java

@ -1,21 +1,19 @@
package com.yihu.jw.basic.resource.controller;
import com.yihu.jw.constants.ServiceApi;
import com.yihu.jw.constants.ApiVersion;
import com.yihu.jw.basic.resource.dao.RsDictionaryEntryDao;
import com.yihu.jw.basic.resource.service.RsDictionaryEntryService;
import com.yihu.jw.constants.ServiceApi;
import com.yihu.jw.entity.ehr.resource.RsDictionaryEntry;
import com.yihu.jw.restmodel.ehr.resource.MRsDictionaryEntry;
import com.yihu.jw.restmodel.ehr.resource.MRsMetadata;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.entity.ehr.resource.RsDictionaryEntry;
import com.yihu.jw.basic.resource.service.RsDictionaryEntryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -143,7 +141,12 @@ public class RsDictionaryEntryEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "根据查询条件获取标准字典项列表_不分页", notes = "根据查询条件获取标准字典项列表_不分页")
    public ListEnvelop searchNoPageRsDictEntries(
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
            @RequestParam(value = "filters", required = false) String filters) throws Exception {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "dictId", value = "字典code")
            @RequestParam(value = "dictId", required = false) String dictId) throws Exception {
        if(StringUtils.isNotBlank(dictId)){
            filters = "dictCode="+dictId;
        }
        List<RsDictionaryEntry> dictionaryEntries = rsDictionaryEntryService.search(filters);
        return success((List<MRsDictionaryEntry>) convertToModels(dictionaryEntries, new ArrayList<>(dictionaryEntries.size()), MRsDictionaryEntry.class, ""));
    }

+ 66 - 12
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/dao/ResourceBrowseDao.java

@ -3,33 +3,27 @@ package com.yihu.jw.basic.resource.dao;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.basic.redis.schema.AdapterMetaDataKeySchema;
import com.yihu.jw.basic.standard.service.redis.StdRedisService;
import com.yihu.jw.basic.resource.service.RedisService;
import com.yihu.jw.basic.resource.service.RsResourceService;
import com.yihu.jw.ehr.redis.schema.StdDataSetKeySchema;
import com.yihu.jw.entity.ehr.resource.*;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.mysql.model.QueryCondition;
import com.yihu.jw.mysql.sqlparser.ParserFactory;
import com.yihu.jw.mysql.sqlparser.ParserSql;
import com.yihu.jw.profile.ProfileType;
import com.yihu.jw.profile.core.ResourceCore;
import com.yihu.jw.profile.family.ResourceCells;
import com.yihu.jw.basic.resource.service.RedisService;
import com.yihu.jw.basic.resource.service.RsResourceService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.entity.ehr.resource.*;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@ -644,7 +638,7 @@ public class ResourceBrowseDao {
     * @return
     * @throws Exception
     */
    public Page<Map<String, Object>> getMysqlDataAndCondition(String sql,String queryParam,String sortParam,Integer page, Integer size) throws Exception {
    public Page<Map<String, Object>> getMysqlDataAndCondition(String sql,String queryParam,String sortParam,Integer page, Integer size,List<String> resourcesCodes) throws Exception {
        String sortOrder = "";
        String sortOrderSql = "";
        if (StringUtils.isNoneBlank(sortParam)){
@ -688,12 +682,43 @@ public class ResourceBrowseDao {
        } else {
            list = jdbcTemplate.queryForList(sql);
        }
        if(list.size()>0){
            //字典翻译
            String resourcesCode = StringUtils.join(resourcesCodes, "','");
            List<DtoResourceMetadata> resourceMetadataList = resourceBrowseMetadataDao.getResourceMetadatasHasDict(resourcesCode);
            if(resourceMetadataList.size()>0){
                Map<String,String> fieldDictMap = resourceMetadataList.stream().collect(Collectors.toMap(DtoResourceMetadata::getEhrId,DtoResourceMetadata::getDictCode));
                Map<String,Map<String,String>> dictMap = new HashMap<>();
                String dictSql = "select * from rs_dictionary_entry where DICT_CODE = ?";
                for (DtoResourceMetadata metadata:resourceMetadataList){
                    String dictCode = metadata.getDictCode();
                    if(!dictMap.containsKey(dictCode)){
                        List<RsDictionaryEntry> dictionaryEntries = jdbcTemplate.query(dictSql,new Object[]{dictCode},new BeanPropertyRowMapper<>(RsDictionaryEntry.class));
                        Map<String,String> tmpMap = dictionaryEntries.stream().collect(Collectors.toMap(RsDictionaryEntry::getCode,RsDictionaryEntry::getName));
                        dictMap.put(dictCode,tmpMap);
                    }
                }
                for (Map<String, Object> map:list){
                    for (Map.Entry<String, String> entry : fieldDictMap.entrySet()) {
                        String key = entry.getKey();
                        String value = entry.getValue();
                        if(map.get(key)!=null){
                            String dictValue =  dictMap.get(value).get(map.get(key));
                            map.put(key,dictValue);
                        }
                    }
                }
            }
        }
        return new PageImpl<>(list, PageRequest.of(page - 1, size), count);
    }
    /**
     * 获取Mysql配置库数据
     *
     * getMysqlData"
     * @param resourcesCode
     * @param page
     * @param size
@ -744,6 +769,35 @@ public class ResourceBrowseDao {
        } else {
            list = jdbcTemplate.queryForList(sql);
        }
        if(list.size()>0){
            //字典翻译
            List<DtoResourceMetadata> resourceMetadataList = resourceBrowseMetadataDao.getResourceMetadataHasDict(resourcesCode);
            if(resourceMetadataList.size()>0){
                Map<String,String> fieldDictMap = resourceMetadataList.stream().collect(Collectors.toMap(DtoResourceMetadata::getStdCode,DtoResourceMetadata::getDictCode));
                Map<String,Map<String,String>> dictMap = new HashMap<>();
                String dictSql = "select * from rs_dictionary_entry where DICT_CODE = ?";
                for (DtoResourceMetadata metadata:resourceMetadataList){
                    String dictCode = metadata.getDictCode();
                    if(!dictMap.containsKey(dictCode)){
                        List<RsDictionaryEntry> dictionaryEntries = jdbcTemplate.query(dictSql,new Object[]{dictCode},new BeanPropertyRowMapper<>(RsDictionaryEntry.class));
                        Map<String,String> tmpMap = dictionaryEntries.stream().collect(Collectors.toMap(RsDictionaryEntry::getCode,RsDictionaryEntry::getName));
                        dictMap.put(dictCode,tmpMap);
                    }
                }
                for (Map<String, Object> map:list){
                    for (Map.Entry<String, String> entry : fieldDictMap.entrySet()) {
                        String key = entry.getKey();
                        String value = entry.getValue();
                        if(map.get(key)!=null){
                            String dictValue =  dictMap.get(value).get(map.get(key));
                            map.put(key,dictValue);
                        }
                    }
                }
            }
        }
        return new PageImpl<>(list, PageRequest.of(page - 1, size), count);
    }

+ 36 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/dao/ResourceBrowseMetadataDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.basic.resource.dao;
import com.yihu.jw.entity.ehr.resource.DtoResourceMetadata;
import com.yihu.jw.entity.ehr.resource.RsResourceMetadata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -21,6 +22,15 @@ public class ResourceBrowseMetadataDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取某资源所有数据元
     */
    public List<RsResourceMetadata> findResourceMetadata(String resourcesCode) throws Exception {
        String sql = "SELECT m.* from rs_resource_metadata m,rs_resource r WHERE m.RESOURCES_ID=r.id and r.`code` = '"+resourcesCode+"'";
        RowMapper rowMapper = BeanPropertyRowMapper.newInstance(RsResourceMetadata.class);
        return jdbcTemplate.query(sql, rowMapper);
    }
    /**
     * 获取某资源所有数据元
     */
@ -34,6 +44,32 @@ public class ResourceBrowseMetadataDao {
        return jdbcTemplate.query(sql, rowMapper);
    }
    /**
     * 获取某资源有字典的数据元
     */
    public List<DtoResourceMetadata> getResourceMetadatasHasDict(String resourcesCodes) throws Exception {
        String sql = "SELECT m.id,m.ehr_id, m.domain, m.name, m.std_code, m.display_code, m.column_type, m.null_able, m.dict_code, m.description, m.valid, a.group_type, a.group_data " +
                "FROM rs_resource_metadata a, rs_resource b, rs_metadata m " +
                "WHERE a.resources_id = b.id " +
                "AND a.metadata_id = m.ehr_id " +
                "AND b.code in ('" + resourcesCodes + "') and m.DICT_CODE is not null ";
        RowMapper rowMapper = BeanPropertyRowMapper.newInstance(DtoResourceMetadata.class);
        return jdbcTemplate.query(sql, rowMapper);
    }
    /**
     * 获取某资源有字典的数据元
     */
    public List<DtoResourceMetadata> getResourceMetadataHasDict(String resourcesCode) throws Exception {
        String sql = "SELECT m.id,m.ehr_id, m.domain, m.name, m.std_code, m.display_code, m.column_type, m.null_able, m.dict_code, m.description, m.valid, a.group_type, a.group_data " +
                "FROM rs_resource_metadata a, rs_resource b, rs_metadata m " +
                "WHERE a.resources_id = b.id " +
                "AND a.metadata_id = m.ehr_id " +
                "AND b.code = '" + resourcesCode + "' and m.DICT_CODE is not null ";
        RowMapper rowMapper = BeanPropertyRowMapper.newInstance(DtoResourceMetadata.class);
        return jdbcTemplate.query(sql, rowMapper);
    }
    /**
     * 获取某资源数据元(根据资源数据元id过滤)
     */

+ 62 - 13
svr/svr-basic/src/main/java/com/yihu/jw/basic/resource/service/ResourceBrowseService.java

@ -3,10 +3,15 @@ package com.yihu.jw.basic.resource.service;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.basic.resource.dao.ResourceBrowseDao;
import com.yihu.jw.basic.resource.dao.ResourceBrowseMetadataDao;
import com.yihu.jw.basic.resource.dao.RsResourceDao;
import com.yihu.jw.basic.resource.dao.RsResourceDefaultParamDao;
import com.yihu.jw.constants.ErrorCode;
import com.yihu.jw.basic.resource.dao.ResourceBrowseDao;
import com.yihu.jw.entity.ehr.resource.DtoResourceMetadata;
import com.yihu.jw.entity.ehr.resource.RsResource;
import com.yihu.jw.entity.ehr.resource.RsResourceDefaultParam;
import com.yihu.jw.entity.ehr.resource.RsResourceMetadata;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.mysql.enums.Operation;
import com.yihu.jw.mysql.model.QueryCondition;
@ -14,10 +19,6 @@ import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.profile.ProfileType;
import com.yihu.jw.profile.family.ResourceCells;
import com.yihu.jw.restmodel.ehr.resource.MRsColumnsModel;
import com.yihu.jw.basic.resource.dao.ResourceBrowseMetadataDao;
import com.yihu.jw.basic.resource.dao.RsResourceDao;
import com.yihu.jw.entity.ehr.resource.DtoResourceMetadata;
import com.yihu.jw.entity.ehr.resource.RsResource;
import com.yihu.jw.restmodel.web.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -41,11 +42,11 @@ public class ResourceBrowseService extends BaseJpaService {
    private ResourceBrowseMetadataDao resourceBrowseMetadataDao;
    @Autowired
    private ResourceBrowseDao resourceBrowseDao;
/*    @Autowired
    private StdTransformClient stdTransformClient;*/
    /*    @Autowired
        private StdTransformClient stdTransformClient;*/
    @Autowired
    private RedisService redisService;
//    @Autowired
    //    @Autowired
//    private ElasticsearchUtil elasticSearchUtil;
    @Autowired
    private RsResourceService rsResourceService;
@ -499,42 +500,86 @@ public class ResourceBrowseService extends BaseJpaService {
        //获取资源编码列表
        List<String> codeList = (List<String>) objectMapper.readValue(resourcesCodes, List.class);
        String tableName = "";
        String where = "";
        Map<String,Integer> relationMap = new HashMap<>();//多视图关联
        Map<String,String> filedMap = new HashMap<>();//参数加别名
        //资源判空检查
        for (String code : codeList) {
            RsResource rsResources = rsResourceService.getResourceByCategory(code,"standard");
            if (rsResources == null) {
                throw new ApiException( "无效的资源编码" + code,ErrorCode.BAD_REQUEST.value());
            }
            List<RsResourceMetadata> resourceMetadataList = resourceBrowseMetadataDao.findResourceMetadata(code);
            for (RsResourceMetadata metadata:resourceMetadataList){
                filedMap.put(metadata.getMetadataId(),code);
            }
            String sortOrder = "";
            List<RsResourceDefaultParam> paramsList = resourceDefaultParamDao.findByResourcesCode(code);
            for (RsResourceDefaultParam param : paramsList) {
                if (param.getParamKey().equals("sort")) {
                    Map<String, String> temp = objectMapper.readValue(param.getParamValue(), Map.class);
                String paramKey = param.getParamKey();
                String paramValue = param.getParamValue();
                if ("sort".equals(paramKey)) {
                    Map<String, String> temp = objectMapper.readValue(paramValue, Map.class);
                    for (Map.Entry<String, String> entry:temp.entrySet()){
                        String key = entry.getKey();
                        String value = entry.getValue();
                        sortOrder ="T."+key+" "+ value+",";
                    }
                }else if (param.getParamKey().equals("table")){
                    tableName += " ("+param.getParamValue()+") "+ code;
                }else if ("table".equals(paramKey)){
                    tableName += " ("+paramValue+") "+ code +",";
                }else if("relation".equals(paramKey)){
                    String relate[] = paramValue.split(",");
                    for (String re:relate){
                        if(relationMap.containsKey(re)){
                            relationMap.put(re,relationMap.get(re)+1);
                        }else {
                            relationMap.put(re,1);
                        }
                    }
                }
            }
        }
        String code1 = codeList.get(0);
        int codeLength = codeList.size();
        for (int i=1;i<codeLength ;i++) {
            String codeTmp = codeList.get(i);
            for (Map.Entry<String, Integer> entry : relationMap.entrySet()) {
                String key = entry.getKey();
                int value = entry.getValue();
                if(value == codeLength){
                    where += " and " + code1+"."+key+"="+codeTmp+"."+key;
                }
            }
        }
        tableName = tableName.substring(0,tableName.length()-1);
        StringBuffer stringBuffer = new StringBuffer();
        if (!StringUtils.isEmpty(queryCondition)) {
            stringBuffer = parseCondition1(queryCondition);
        }
        stringBuffer.append(where);
        //数据元信息字段
        if(!StringUtils.isEmpty(metaData)){
            metaData = metaData.replaceAll(",","\",\"");
        }
        List<String> customizeList = (List<String>) objectMapper.readValue(metaData, List.class);
        //参数集合
        List<String> paramList = new ArrayList<>(customizeList.size() * 2);
        for (String id : customizeList) {
            String codeTmp = filedMap.get(id);
            if(id.contains("-")){
                String tmp = id.substring(id.lastIndexOf("-")+1);
                id = tmp + " as '" +id+"'";
            }
            if(codeTmp!=null){
                id = codeTmp+"."+id;
            }
            paramList.add(id);
        }
        String queryString = org.apache.commons.lang3.StringUtils.join(paramList, ",");
        String sql = " select "+queryString+" from "+tableName;
        String sortParam = "";
        return resourceBrowseDao.getMysqlDataAndCondition(sql, stringBuffer.toString(),sortParam, page, size);
        return resourceBrowseDao.getMysqlDataAndCondition(sql, stringBuffer.toString(),sortParam, page, size,codeList);
    }
    /**
@ -678,6 +723,10 @@ public class ResourceBrowseService extends BaseJpaService {
            for (Map<String, Object> item : list) {
                String andOr = String.valueOf(item.get("andOr")).trim();
                String field = String.valueOf(item.get("field")).trim();
                if(field.contains("-")){
                    field = field.substring(field.lastIndexOf("-")+1);
//                    id = tmp + " as '" +id+"'";
                }
                String cond = String.valueOf(item.get("condition")).trim();
                String value = String.valueOf(item.get("value"));
                stringBuffer.append(" "+andOr+" "+field+cond+"'"+value+"' ");

+ 9 - 0
svr/svr-basic/src/main/resources/application.yml

@ -144,6 +144,15 @@ spring:
    url: jdbc:mysql://172.26.0.114:3306/healtharchive?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    username: root
    password: 4D^tK%!4
#hibernate 配置
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: true
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
  physical_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
  implicit_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
  # -- unknown use --
  ldap:
    host: 172.19.103.87