路泰机电科技体检——数据平台后端
zhaowenxuan
2025-04-15 c4ea4cf098ec9fb74aa82530970c9c2e98aec6b8
同步字典从数据库查询
1个文件已修改
5个文件已添加
428 ■■■■■ 已修改文件
src/main/java/com/example/domain/DictHosp.java 310 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/mapper/DictHospMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/scheudleds/DictSyncCommon.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/service/DictHospService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/service/impl/DictHospServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DictHospMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/example/domain/DictHosp.java
New file
@@ -0,0 +1,310 @@
package com.example.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import lombok.Data;
/**
 * 院区信息表
 * @TableName dict_hosp
 */
@TableName(value ="dict_hosp")
@Data
public class DictHosp implements Serializable {
    /**
     * 院区ID
     */
    @TableId
    private String hospAreaId;
    /**
     * 院区名称
     */
    private String hospAreaName;
    /**
     * 医疗机构ID
     */
    private String hospid;
    /**
     * 医疗机构名称
     */
    private String hospName;
    /**
     * 院区编码
     */
    private String code;
    /**
     * 五笔简码
     */
    private String wbm;
    /**
     * 拼音简码
     */
    private String spell;
    /**
     * 行政区划ID
     */
    private String areaid;
    /**
     * 行政区划名称
     */
    private String areaName;
    /**
     * 是否主院区 0-不是 1-是
     */
    private String mainHospArea;
    /**
     * 负责人
     */
    private String principal;
    /**
     * 负责人电话
     */
    private String phone;
    /**
     * 编制床位数
     */
    private Integer plaitBed;
    /**
     * 开放床位数
     */
    private Integer openBed;
    /**
     * 建立日期
     */
    private Date buildDate;
    /**
     * 备注
     */
    private String remark;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 修改人
     */
    private String updateBy;
    /**
     * 修改时间
     */
    private Date updateTime;
    /**
     * 排序
     */
    private Integer orderNum;
    /**
     * 数据状态(PT10.00.004)
     */
    private String effective;
    /**
     * 创建人姓名
     */
    private String createByName;
    /**
     * 修改人姓名
     */
    private String updateByName;
    /**
     * 0删除1未删除
     */
    private Integer deleted;
    /**
     * 创建人id
     */
    private String createId;
    /**
     * 修改人id
     */
    private String updateId;
    /**
     * 秘钥
     */
    private String secretKey;
    /**
     * 到期时间
     */
    private Date expirationTime;
    /**
     * 数据库名
     */
    private String dbname;
    /**
     * 中间层中HisServiceBeanName在ServiceFactory类中查看
     */
    private String beanName;
    /**
     * 图片(Base64编码)
     */
    private byte[] imgbase64;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DictHosp other = (DictHosp) that;
        return (this.getHospAreaId() == null ? other.getHospAreaId() == null : this.getHospAreaId().equals(other.getHospAreaId()))
            && (this.getHospAreaName() == null ? other.getHospAreaName() == null : this.getHospAreaName().equals(other.getHospAreaName()))
            && (this.getHospid() == null ? other.getHospid() == null : this.getHospid().equals(other.getHospid()))
            && (this.getHospName() == null ? other.getHospName() == null : this.getHospName().equals(other.getHospName()))
            && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
            && (this.getWbm() == null ? other.getWbm() == null : this.getWbm().equals(other.getWbm()))
            && (this.getSpell() == null ? other.getSpell() == null : this.getSpell().equals(other.getSpell()))
            && (this.getAreaid() == null ? other.getAreaid() == null : this.getAreaid().equals(other.getAreaid()))
            && (this.getAreaName() == null ? other.getAreaName() == null : this.getAreaName().equals(other.getAreaName()))
            && (this.getMainHospArea() == null ? other.getMainHospArea() == null : this.getMainHospArea().equals(other.getMainHospArea()))
            && (this.getPrincipal() == null ? other.getPrincipal() == null : this.getPrincipal().equals(other.getPrincipal()))
            && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
            && (this.getPlaitBed() == null ? other.getPlaitBed() == null : this.getPlaitBed().equals(other.getPlaitBed()))
            && (this.getOpenBed() == null ? other.getOpenBed() == null : this.getOpenBed().equals(other.getOpenBed()))
            && (this.getBuildDate() == null ? other.getBuildDate() == null : this.getBuildDate().equals(other.getBuildDate()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum()))
            && (this.getEffective() == null ? other.getEffective() == null : this.getEffective().equals(other.getEffective()))
            && (this.getCreateByName() == null ? other.getCreateByName() == null : this.getCreateByName().equals(other.getCreateByName()))
            && (this.getUpdateByName() == null ? other.getUpdateByName() == null : this.getUpdateByName().equals(other.getUpdateByName()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
            && (this.getCreateId() == null ? other.getCreateId() == null : this.getCreateId().equals(other.getCreateId()))
            && (this.getUpdateId() == null ? other.getUpdateId() == null : this.getUpdateId().equals(other.getUpdateId()))
            && (this.getSecretKey() == null ? other.getSecretKey() == null : this.getSecretKey().equals(other.getSecretKey()))
            && (this.getExpirationTime() == null ? other.getExpirationTime() == null : this.getExpirationTime().equals(other.getExpirationTime()))
            && (this.getDbname() == null ? other.getDbname() == null : this.getDbname().equals(other.getDbname()))
            && (this.getBeanName() == null ? other.getBeanName() == null : this.getBeanName().equals(other.getBeanName()))
            && (Arrays.equals(this.getImgbase64(), other.getImgbase64()));
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getHospAreaId() == null) ? 0 : getHospAreaId().hashCode());
        result = prime * result + ((getHospAreaName() == null) ? 0 : getHospAreaName().hashCode());
        result = prime * result + ((getHospid() == null) ? 0 : getHospid().hashCode());
        result = prime * result + ((getHospName() == null) ? 0 : getHospName().hashCode());
        result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
        result = prime * result + ((getWbm() == null) ? 0 : getWbm().hashCode());
        result = prime * result + ((getSpell() == null) ? 0 : getSpell().hashCode());
        result = prime * result + ((getAreaid() == null) ? 0 : getAreaid().hashCode());
        result = prime * result + ((getAreaName() == null) ? 0 : getAreaName().hashCode());
        result = prime * result + ((getMainHospArea() == null) ? 0 : getMainHospArea().hashCode());
        result = prime * result + ((getPrincipal() == null) ? 0 : getPrincipal().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getPlaitBed() == null) ? 0 : getPlaitBed().hashCode());
        result = prime * result + ((getOpenBed() == null) ? 0 : getOpenBed().hashCode());
        result = prime * result + ((getBuildDate() == null) ? 0 : getBuildDate().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode());
        result = prime * result + ((getEffective() == null) ? 0 : getEffective().hashCode());
        result = prime * result + ((getCreateByName() == null) ? 0 : getCreateByName().hashCode());
        result = prime * result + ((getUpdateByName() == null) ? 0 : getUpdateByName().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getCreateId() == null) ? 0 : getCreateId().hashCode());
        result = prime * result + ((getUpdateId() == null) ? 0 : getUpdateId().hashCode());
        result = prime * result + ((getSecretKey() == null) ? 0 : getSecretKey().hashCode());
        result = prime * result + ((getExpirationTime() == null) ? 0 : getExpirationTime().hashCode());
        result = prime * result + ((getDbname() == null) ? 0 : getDbname().hashCode());
        result = prime * result + ((getBeanName() == null) ? 0 : getBeanName().hashCode());
        result = prime * result + (Arrays.hashCode(getImgbase64()));
        return result;
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", hospAreaId=").append(hospAreaId);
        sb.append(", hospAreaName=").append(hospAreaName);
        sb.append(", hospid=").append(hospid);
        sb.append(", hospName=").append(hospName);
        sb.append(", code=").append(code);
        sb.append(", wbm=").append(wbm);
        sb.append(", spell=").append(spell);
        sb.append(", areaid=").append(areaid);
        sb.append(", areaName=").append(areaName);
        sb.append(", mainHospArea=").append(mainHospArea);
        sb.append(", principal=").append(principal);
        sb.append(", phone=").append(phone);
        sb.append(", plaitBed=").append(plaitBed);
        sb.append(", openBed=").append(openBed);
        sb.append(", buildDate=").append(buildDate);
        sb.append(", remark=").append(remark);
        sb.append(", createBy=").append(createBy);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", orderNum=").append(orderNum);
        sb.append(", effective=").append(effective);
        sb.append(", createByName=").append(createByName);
        sb.append(", updateByName=").append(updateByName);
        sb.append(", deleted=").append(deleted);
        sb.append(", createId=").append(createId);
        sb.append(", updateId=").append(updateId);
        sb.append(", secretKey=").append(secretKey);
        sb.append(", expirationTime=").append(expirationTime);
        sb.append(", dbname=").append(dbname);
        sb.append(", beanName=").append(beanName);
        sb.append(", imgbase64=").append(imgbase64);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
src/main/java/com/example/mapper/DictHospMapper.java
New file
@@ -0,0 +1,18 @@
package com.example.mapper;
import com.example.domain.DictHosp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author w
* @description 针对表【dict_hosp(院区信息表)】的数据库操作Mapper
* @createDate 2025-04-15 08:59:12
* @Entity com.example.domain.DictHosp
*/
public interface DictHospMapper extends BaseMapper<DictHosp> {
}
src/main/java/com/example/scheudleds/DictSyncCommon.java
@@ -1,6 +1,9 @@
package com.example.scheudleds;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.domain.DictHosp;
import com.example.factory.ServiceFactory;
import com.example.service.DictHospService;
import com.example.service.HisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -11,6 +14,7 @@
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@Slf4j
@Component
@@ -25,9 +29,14 @@
    private final ExecutorService executorService = Executors.newFixedThreadPool(40);
    @Autowired
    private DictHospService dictHospService;
    @Scheduled(cron = "0 0 22 * * ?")
    public void executeTasks() {
        List<String> list = Arrays.asList("shanxiqinxamjyy","shanxiqinpbkwyy","shanxiqinjdczgzyy","shanxiqinsqyy");
//        List<String> list = Arrays.asList("shanxiqinxamjyy","shanxiqinpbkwyy","shanxiqinjdczgzyy","shanxiqinsqyy");
        List<String> list = dictHospService.list(new LambdaQueryWrapper<DictHosp>().isNotNull(DictHosp::getBeanName))
                .stream().map(DictHosp::getBeanName).collect(Collectors.toList());
        log.info("开始执行定时任务:{}", System.currentTimeMillis());
        try {
            for (String hosp : list) {
src/main/java/com/example/service/DictHospService.java
New file
@@ -0,0 +1,13 @@
package com.example.service;
import com.example.domain.DictHosp;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author w
* @description 针对表【dict_hosp(院区信息表)】的数据库操作Service
* @createDate 2025-04-15 08:59:12
*/
public interface DictHospService extends IService<DictHosp> {
}
src/main/java/com/example/service/impl/DictHospServiceImpl.java
New file
@@ -0,0 +1,22 @@
package com.example.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.DictHosp;
import com.example.service.DictHospService;
import com.example.mapper.DictHospMapper;
import org.springframework.stereotype.Service;
/**
* @author w
* @description 针对表【dict_hosp(院区信息表)】的数据库操作Service实现
* @createDate 2025-04-15 08:59:12
*/
@Service
public class DictHospServiceImpl extends ServiceImpl<DictHospMapper, DictHosp>
    implements DictHospService{
}
src/main/resources/mapper/DictHospMapper.xml
New file
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.mapper.DictHospMapper">
    <resultMap id="BaseResultMap" type="com.example.domain.DictHosp">
            <id property="hospAreaId" column="hosp_area_id" jdbcType="VARCHAR"/>
            <result property="hospAreaName" column="hosp_area_name" jdbcType="VARCHAR"/>
            <result property="hospid" column="hospId" jdbcType="VARCHAR"/>
            <result property="hospName" column="hosp_name" jdbcType="VARCHAR"/>
            <result property="code" column="code" jdbcType="VARCHAR"/>
            <result property="wbm" column="wbm" jdbcType="VARCHAR"/>
            <result property="spell" column="spell" jdbcType="VARCHAR"/>
            <result property="areaid" column="areaId" jdbcType="VARCHAR"/>
            <result property="areaName" column="area_name" jdbcType="VARCHAR"/>
            <result property="mainHospArea" column="main_hosp_area" jdbcType="VARCHAR"/>
            <result property="principal" column="principal" jdbcType="VARCHAR"/>
            <result property="phone" column="phone" jdbcType="VARCHAR"/>
            <result property="plaitBed" column="plait_bed" jdbcType="INTEGER"/>
            <result property="openBed" column="open_bed" jdbcType="INTEGER"/>
            <result property="buildDate" column="build_date" jdbcType="DATE"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
            <result property="effective" column="effective" jdbcType="VARCHAR"/>
            <result property="createByName" column="create_by_name" jdbcType="VARCHAR"/>
            <result property="updateByName" column="update_by_name" jdbcType="VARCHAR"/>
            <result property="deleted" column="deleted" jdbcType="TINYINT"/>
            <result property="createId" column="create_id" jdbcType="VARCHAR"/>
            <result property="updateId" column="update_id" jdbcType="VARCHAR"/>
            <result property="secretKey" column="secret_key" jdbcType="VARCHAR"/>
            <result property="expirationTime" column="expiration_time" jdbcType="TIMESTAMP"/>
            <result property="dbname" column="dbname" jdbcType="VARCHAR"/>
            <result property="beanName" column="bean_name" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
        hosp_area_id,hosp_area_name,hospId,
        hosp_name,code,wbm,
        spell,areaId,area_name,
        main_hosp_area,principal,phone,
        plait_bed,open_bed,build_date,
        remark,create_by,create_time,
        update_by,update_time,order_num,
        effective,create_by_name,update_by_name,
        deleted,create_id,update_id,
        secret_key,expiration_time,dbname,
        bean_name,imgBase64
    </sql>
</mapper>