forked from kidgrow-microservices-platform

zhaoxiaohao
2021-02-26 a954287ddcfe800adb6110bafc6a33a65206211a
Merge branch 'dev' of ssh://192.168.2.240:29418/kidgrow-microservices-platform into dev
15 files added
3 files modified
2825 ■■■■■ changed files
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/EquipmentDocking.java 145 ●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/PartnerDockingInfo.java 104 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/PartnerInfo.java 79 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/mapper/PartnerDockingInfoMapper.java 34 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/mapper/PartnerInfoMapper.java 41 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/IPartnerDockingInfoService.java 40 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/IPartnerInfoService.java 41 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/PartnerDockingInfoServiceImpl.java 401 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/PartnerInfoServiceImpl.java 58 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/PartnerDockingInfoMapper.xml 102 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/PartnerInfoMapper.xml 105 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/template/imageServer_template.sql 551 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/java/com/kidgrow/oprationcenter/controller/PartnerDockingInfoController.java 194 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/java/com/kidgrow/oprationcenter/controller/PartnerInfoController.java 152 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/resources/application.yml 2 ●●●●● patch | view | raw | blame | history
kidgrow-commons/kidgrow-common-spring-boot-starter/src/main/java/com/kidgrow/common/constant/SecurityConstants.java 6 ●●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/partnerDockingInfo.html 407 ●●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/partnerInfo.html 363 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/EquipmentDocking.java
@@ -15,11 +15,12 @@
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @version 1.0
 * @Description: <br>
 * @Project: 用户中心<br>
 * @CreateDate: Created in 2020-10-19 11:14:58 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 * @version 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@@ -27,76 +28,76 @@
@AllArgsConstructor
@TableName("equipment_docking")
public class EquipmentDocking extends SuperModel {
    private static final long serialVersionUID=1L;
    private static final long serialVersionUID = 1L;
            /**
    * 医院名称
    */
        @NotEmpty(message = "医院名称不能为空")
        private String hospitalName;
            /**
    * 科室名称
    */
        @NotEmpty(message = "科室名称不能为空")
        private String departName;
            /**
    * 医院唯一标识
    */
        @NotNull(message = "医院唯一标识不能为空")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long hospitalId;
            /**
    * 部门唯一表示
    */
            @NotNull(message = "部门唯一表示不能为空")
            @JsonSerialize(using = ToStringSerializer.class)
        private Long departId;
            /**
    * 设备厂家名称
    */
        @NotEmpty(message = "设备厂家名称不能为空")
        private String companyName;
            /**
    * 设备型号
    */
        @NotEmpty(message = "设备型号不能为空")
        private String unitType;
            /**
    * 设备品牌
    */
        @NotEmpty(message = "设备品牌不能为空")
        private String equipmentBrand;
            /**
    * 设备机器码
    */
        @NotEmpty(message = "设备机器码不能为空")
        private String machineCode;
            /**
    * hospital_id+depart_id+machine_code 进行md5加密生成的32位小写的字符串
    */
    /**
     * 医院名称
     */
    @NotEmpty(message = "医院名称不能为空")
    private String hospitalName;
    /**
     * 科室名称
     */
    @NotEmpty(message = "科室名称不能为空")
    private String departName;
    /**
     * 医院唯一标识
     */
    @NotNull(message = "医院唯一标识不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long hospitalId;
    /**
     * 部门唯一表示
     */
    @NotNull(message = "部门唯一表示不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long departId;
    /**
     * 设备厂家名称
     */
    @NotEmpty(message = "设备厂家名称不能为空")
    private String companyName;
    /**
     * 设备型号
     */
    @NotEmpty(message = "设备型号不能为空")
    private String unitType;
    /**
     * 设备品牌
     */
    @NotEmpty(message = "设备品牌不能为空")
    private String equipmentBrand;
    /**
     * 设备机器码
     */
    @NotEmpty(message = "设备机器码不能为空")
    private String machineCode;
    /**
     * hospital_id+depart_id+machine_code 进行md5加密生成的32位小写的字符串
     */
//        @NotEmpty(message = "hospital_id+depart_id+machine_code 进行md5加密生成的32位小写的字符串不能为空")
        private String outAccesskey;
            /**
    * 设备厂家联系人电话
    */
        @NotEmpty(message = "设备厂家联系人电话不能为空")
        private String contactPhone;
            /**
    * 设备厂家联系人名称
    */
        @NotEmpty(message = "设备厂家联系人名称不能为空")
        private String contactName;
            /**
    * 备注信息
    */
        private String remarkComment;
                                    /**
    * 状态,1启用,0停用
    */
        private Boolean enabled;
            /**
    * 是否删除,1删除,0未删除
    */
        @TableLogic
        private Boolean isDel;
    }
    private String outAccesskey;
    /**
     * 设备厂家联系人电话
     */
    @NotEmpty(message = "设备厂家联系人电话不能为空")
    private String contactPhone;
    /**
     * 设备厂家联系人名称
     */
    @NotEmpty(message = "设备厂家联系人名称不能为空")
    private String contactName;
    /**
     * 备注信息
     */
    private String remarkComment;
    /**
     * 状态,1启用,0停用
     */
    private Boolean enabled;
    /**
     * 是否删除,1删除,0未删除
     */
    @TableLogic
    private Boolean isDel;
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/PartnerDockingInfo.java
New file
@@ -0,0 +1,104 @@
package com.kidgrow.oprationcenter.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.kidgrow.common.model.SuperModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @version 1.0
 * @Description: 合作商客户对接信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:33 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@TableName("partner_docking_info")
public class PartnerDockingInfo extends SuperModel {
    private static final long serialVersionUID = 1L;
    /**
     * 合作商ID
     */
    @NotNull(message = "合作商唯一标识不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long partnerId;
    /**
     * 合作商名称
     */
    @NotEmpty(message = "合作商名称不能为空")
    private String partnerName;
    /**
     * 医院ID
     */
    @NotNull(message = "医院唯一标识不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long hospitalId;
    /**
     * 医院名称
     */
    @NotEmpty(message = "医院名称不能为空")
    private String hospitalName;
    /**
     * 科室ID
     */
    @NotNull(message = "科室唯一标识不能为空")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long departmentId;
    /**
     * 科室名称
     */
    @NotEmpty(message = "科室名称不能为空")
    private String departmentName;
    /**
     * 对接类型(1:影像版API,2:妇幼版API)
     */
    private Integer dockingType;
    /**
     * 对接版本
     */
    @NotEmpty(message = "对接版本不能为空")
    private String dockingVersion;
    /**
     * 对接状态(1:正常,2:暂停)
     */
    private Integer dockingStatus;
    /**
     * 服务器机器码
     */
    private String serverMachineCode;
    /**
     * 服务器软加密码
     */
    private String accessKey;
    /**
     * 操作人
     */
    @NotEmpty(message = "操作人不能为空")
    private String operationName;
    /**
     * 操作时间
     */
    private Date operationTime;
    /**
     * 是否删除,1删除,0未删除
     */
    private Boolean isDel;
    /**
     * 状态,1启用,0停用
     */
    private Boolean enabled;
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-api/src/main/java/com/kidgrow/oprationcenter/model/PartnerInfo.java
New file
@@ -0,0 +1,79 @@
package com.kidgrow.oprationcenter.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kidgrow.common.model.SuperModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @version 1.0
 * @Description: 合作商信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:30 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@TableName("partner_info")
public class PartnerInfo extends SuperModel {
    private static final long serialVersionUID = 1L;
    /**
     * 合作商名称
     */
    private String partnerName;
    /**
     * 合作商类型(1:区域经销商;2:设备供应商;3:系统集成商;4:行业代理商;5:个人)
     */
    private Integer partnerType;
    /**
     * 合作商地址
     */
    private String partnerAddress;
    /**
     * 合作商所在省
     */
    private String partnerProvince;
    /**
     * 合作商所在市
     */
    private String partnerCity;
    /**
     * 合作商所在区县
     */
    private String partnerArea;
    /**
     * 合作商联系人
     */
    private String partnerLinkMan;
    /**
     * 合作商联系电话
     */
    private String partnerLinkTelephone;
    /**
     * 合作商合作区域
     */
    private String partnerBussinessArea;
    /**
     * 合作商简介
     */
    private String partnerIntroduce;
    /**
     * 合作商唯一标识码
     */
    private String partnerUniqueCode;
    /**
     * 是否删除,1删除,0未删除
     */
    private Boolean isDel;
    /**
     * 状态,1启用,0停用
     */
    private Boolean enabled;
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/mapper/PartnerDockingInfoMapper.java
New file
@@ -0,0 +1,34 @@
package com.kidgrow.oprationcenter.mapper;
import com.kidgrow.oprationcenter.model.PartnerDockingInfo;
import com.kidgrow.db.mapper.SuperMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商客户对接信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:33 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version 1.0
 */
public interface PartnerDockingInfoMapper extends SuperMapper<PartnerDockingInfo> {
    /**
     * 分页查询合作商客户对接信息表列表
     * @param page
     * @param params
     * @return
     */
    List<PartnerDockingInfo> findList(Page<PartnerDockingInfo> page, @Param("p") Map<String, Object> params);
    /**
     * 根据PartnerDockingInfo对象当做查询条件进行查询
     * @param
     * @return PartnerDockingInfo对象
     */
    PartnerDockingInfo findByObject(@Param("p") PartnerDockingInfo partnerDockingInfo);
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/mapper/PartnerInfoMapper.java
New file
@@ -0,0 +1,41 @@
package com.kidgrow.oprationcenter.mapper;
import com.kidgrow.oprationcenter.model.PartnerInfo;
import com.kidgrow.db.mapper.SuperMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:30 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version 1.0
 */
public interface PartnerInfoMapper extends SuperMapper<PartnerInfo> {
    /**
     * 分页查询合作商信息表列表
     * @param page
     * @param params
     * @return
     */
    List<PartnerInfo> findList(Page<PartnerInfo> page, @Param("p") Map<String, Object> params);
    /**
     * 根据PartnerInfo对象当做查询条件进行查询
     * @param
     * @return PartnerInfo对象
     */
    PartnerInfo findByObject(@Param("p") PartnerInfo partnerInfo);
    /**
     * 根据名称查询合作商名称列表
     * @param partnerName
     * @return
     */
    List<PartnerInfo> findByName(@Param("partnerName") String partnerName);
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/IPartnerDockingInfoService.java
New file
@@ -0,0 +1,40 @@
package com.kidgrow.oprationcenter.service;
import com.kidgrow.oprationcenter.model.PartnerDockingInfo;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.service.ISuperService;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商客户对接信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:33 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version 1.0
 */
public interface IPartnerDockingInfoService extends ISuperService<PartnerDockingInfo> {
    /**
     * 列表
     * @param params
     * @return
     */
    PageResult<PartnerDockingInfo> findList(Map<String, Object> params);
    /**
    * 根据PartnerDockingInfo对象当做查询条件进行查询
    * @param partnerDockingInfo
    * @return PartnerDockingInfo对象
    */
    PartnerDockingInfo findByObject(PartnerDockingInfo partnerDockingInfo);
    /**
     * 根据对接类型版本等信息,创建客户私有云数据库脚本
     * @param partnerDockingInfo
     * @return
     */
    String createSQL( PartnerDockingInfo partnerDockingInfo );
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/IPartnerInfoService.java
New file
@@ -0,0 +1,41 @@
package com.kidgrow.oprationcenter.service;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.service.ISuperService;
import com.kidgrow.oprationcenter.model.PartnerInfo;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:30 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version 1.0
 */
public interface IPartnerInfoService extends ISuperService<PartnerInfo> {
    /**
     * 列表
     * @param params
     * @return
     */
    PageResult<PartnerInfo> findList(Map<String, Object> params);
    /**
    * 根据PartnerInfo对象当做查询条件进行查询
    * @param partnerInfo
    * @return PartnerInfo对象
    */
    PartnerInfo findByObject(PartnerInfo partnerInfo);
    /**
     * 根据名称查询合作商名称列表
     * @param partnerName
     * @return
     */
    List<PartnerInfo> findByName(String partnerName);
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/PartnerDockingInfoServiceImpl.java
New file
@@ -0,0 +1,401 @@
package com.kidgrow.oprationcenter.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kidgrow.common.constant.SecurityConstants;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.model.ResultBody;
import com.kidgrow.common.service.impl.SuperServiceImpl;
import com.kidgrow.common.utils.EncryptUtils;
import com.kidgrow.oprationcenter.mapper.PartnerDockingInfoMapper;
import com.kidgrow.oprationcenter.model.PartnerDockingInfo;
import com.kidgrow.oprationcenter.model.PartnerInfo;
import com.kidgrow.oprationcenter.model.ProductOrder;
import com.kidgrow.oprationcenter.model.ProductOrderRecord;
import com.kidgrow.oprationcenter.service.IPartnerDockingInfoService;
import com.kidgrow.oprationcenter.service.IPartnerInfoService;
import com.kidgrow.oprationcenter.service.IProductOrderRecordService;
import com.kidgrow.oprationcenter.service.IProductOrderService;
import com.kidgrow.usercenter.feign.SysDepartmentService;
import com.kidgrow.usercenter.feign.SysDoctorService;
import com.kidgrow.usercenter.feign.SysHospitalService;
import com.kidgrow.usercenter.model.SysDoctor;
import com.kidgrow.usercenter.model.SysHospital;
import io.undertow.util.FileUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @version 1.0
 * @Description: 合作商客户对接信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:33 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 */
@Slf4j
@Service
public class PartnerDockingInfoServiceImpl extends SuperServiceImpl<PartnerDockingInfoMapper, PartnerDockingInfo> implements IPartnerDockingInfoService {
    @Autowired
    ResourceLoader resourceLoader;
    @Autowired
    SysHospitalService sysHospitalService;
    @Autowired
    SysDepartmentService sysDepartmentService;
    @Autowired
    SysDoctorService sysDoctorService;
    @Autowired
    IPartnerInfoService partnerInfoService;
    @Autowired
    IProductOrderService productOrderService;
    @Autowired
    IProductOrderRecordService productOrderRecordService;
    /**
     * 列表
     *
     * @param params
     * @return
     */
    @Override
    public PageResult<PartnerDockingInfo> findList(Map<String, Object> params) {
        Page<PartnerDockingInfo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
        List<PartnerDockingInfo> list = baseMapper.findList(page, params);
        return PageResult.<PartnerDockingInfo>builder().data(list).code(0).count(page.getTotal()).build();
    }
    /**
     * 根据PartnerDockingInfo对象当做查询条件进行查询
     *
     * @param partnerDockingInfo
     * @return PartnerDockingInfo
     */
    @Override
    public PartnerDockingInfo findByObject(PartnerDockingInfo partnerDockingInfo) {
        return baseMapper.findByObject(partnerDockingInfo);
    }
    /**
     * 根据对接类型版本等信息,创建客户私有云数据库脚本
     *
     * @param partnerDockingInfo
     * @return
     */
    @Override
    public String createSQL(PartnerDockingInfo partnerDockingInfo) {
        // 模板SQL文
        String dbSql = "";
        // 医院信息SQL文
        String hospitalSQL = "";
        // 科室信息SQL文
        String departmentSQL = "";
        // 医生信息SQL文
        String doctorSQL = "";
        // 合作商信息SQL文
        String partnerSQL = "";
        // 服务器信息SQL文
        String serverSQL = "";
        // 服务期限和数量的SQL文
        String serviceSQL = "";
        InputStream fileImput = null;
        // 时间转换格式
        SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = "";
        String updateTime = "";
        try {
            // 1、读取基础表结构SQL
            Resource resource = resourceLoader.getResource("classpath:template//imageServer_template.sql");
            fileImput = resource.getInputStream();  //new FileInputStream("./template/imageServer_template.sql");
            dbSql = FileUtils.readFile(fileImput);
            // 2、读取医院信息表Hospital_Info,插入SQL文中
            Map<String, Object> hospitalMap = new HashMap<>();
            hospitalMap.put("id", partnerDockingInfo.getHospitalId());
            ResultBody hospitalResult = sysHospitalService.findAllByMap(hospitalMap);
            if (hospitalResult.isOk()) {
                String jsonData = JSONObject.toJSONString(hospitalResult.getData());
                List<SysHospital> hospitalLists = JSONObject.parseArray(jsonData, SysHospital.class);
                if (hospitalLists.size() > 0) {
                    SysHospital hospitalInfo = hospitalLists.get(0);
                    createTime = "'" + dateTimeFormat.format(hospitalInfo.getCreateTime()) + "'";
                    updateTime = (hospitalInfo.getUpdateTime() == null) ? "NULL" : "'" + dateTimeFormat.format(hospitalInfo.getUpdateTime())+ "'";
                    hospitalSQL = " INSERT INTO sys_hospital  VALUES (" +
                            hospitalInfo.getId() + ", " +
                            "'" + hospitalInfo.getHospitalName() + "', " +
                            "'" + hospitalInfo.getHospitalShortName() + "', " +
                            "'" + hospitalInfo.getHospitalCode() + "', " +
                            "'" + hospitalInfo.getHospitalTypeId() + "', " +
                            "'" + hospitalInfo.getHospitalTypeName() + "', " +
                            "'" + hospitalInfo.getHospitalTel() + "', " +
                            "'" + hospitalInfo.getHospitalProvince() + "', " +
                            "'" + hospitalInfo.getHospitalCity() + "', " +
                            "'" + hospitalInfo.getHospitalArea() + "', " +
                            "'" + hospitalInfo.getAreaCode() + "', " +
                            "'" + hospitalInfo.getHospitalLink() + "', " +
                            "'" + hospitalInfo.getHospitalAdress() + "', " +
                            "'" + hospitalInfo.getLatitude() + "', " +
                            "'" + hospitalInfo.getLongitude() + "', " +
                            "'" + hospitalInfo.getHospitalQualifiedId() + "', " +
                            "'" + hospitalInfo.getHospitalQualifiedName() + "', " +
                            "NULL," +
                            "NULL," +
                            "NULL," +
                            "'" + hospitalInfo.getHospitalAbout() + "', " +
                            hospitalInfo.getHospitalState() + ", " +
                            hospitalInfo.getEnabled() + ", " +
                            hospitalInfo.getIsDel() + ", " +
                            hospitalInfo.getCreateUserId() + ", " +
                            "'" + hospitalInfo.getCreateUserName() + "', " +
                            hospitalInfo.getUpdateUserId() + ", " +
                            "'" + hospitalInfo.getUpdateUserName() + "', " +
                            createTime + ", " +
                            updateTime + " " +
                            ");\n\r";
                } else {
                    return "医院信息读取失败,请重新生成SQL!";
                }
            } else {
                return "医院信息读取失败,请重新生成SQL!";
            }
            // 3、读取科室信息表Department_Info,生成SQL文
            departmentSQL = "INSERT INTO sys_department VALUES (" +
                    +partnerDockingInfo.getDepartmentId() + ", " +
                    "'" + partnerDockingInfo.getDepartmentName() + "', " +
                    +partnerDockingInfo.getHospitalId() + ", " +
                    "0, 1, 0, '喜高科技', 0 , '喜高科技', " +
                    "'" + DateTime.now().toString() + "', " +
                    "'" + DateTime.now().toString() + "', " +
                    "6 " +
                    ");\n\r";
            // 4、读取医生信息表Doctor_Info,生成SQL文
            Map<String, Object> doctorMap = new HashMap<>();
            doctorMap.put("hospital_id", partnerDockingInfo.getHospitalId());
            doctorMap.put("department_id", partnerDockingInfo.getDepartmentId());
            doctorMap.put("is_admin_user", 1);
            ResultBody doctorResult = sysDoctorService.getListByMap(doctorMap);
            if (doctorResult.isOk()) {
                String jsonData = JSONObject.toJSONString(doctorResult.getData());
                List<SysDoctor> doctorList = JSONObject.parseArray(jsonData, SysDoctor.class);
                if (doctorList.size() > 0) {
                    SysDoctor doctorInfo = doctorList.get(0);
                    doctorSQL = "INSERT INTO sys_doctor VALUES(" +
                            doctorInfo.getId() + ", " +
                            +doctorInfo.getHospitalId() + ", " +
                            "'" + doctorInfo.getHospitalName() + "', " +
                            +doctorInfo.getDepartmentId() + ", " +
                            "'" + doctorInfo.getDepartmentName() + "', " +
                            "'" + doctorInfo.getDoctorName() + "', " +
                            "NULL, NULL, " +
                            "'" + doctorInfo.getDoctorTel() + "', " +
                            "'" + DigestUtils.md5DigestAsHex("123456".getBytes()).replace("-", "") + "', " +
                            "'" + doctorInfo.getDoctorRankId() + "', " +
                            "'" + doctorInfo.getDoctorRank() + "', " +
                            "'" + doctorInfo.getDoctorOtherLink() + "', " +
                            "'" + doctorInfo.getDoctorEmail() + "', " +
                            "'" + doctorInfo.getDoctorAbout() + "', " +
                            "0, " +
                            doctorInfo.getDoctorState() + ", " +
                            doctorInfo.getDoctorType() + ", " +
                            "1, 0, '喜高科技', 0 , '喜高科技', " +
                            "'" + DateTime.now().toString() + "', " +
                            "'" + DateTime.now().toString() + "', " +
                            "1" +
                            ");\n\r";
                } else {
                    return "医生信息读取失败,请先创建管理员,再重新生成SQL!";
                }
            } else {
                return "医生信息读取失败,请先创建管理员,再重新生成SQL!";
            }
            // 5、读取合作商信息表Partner_Info,生成SQL文
            PartnerInfo partnerInfo = partnerInfoService.getById(partnerDockingInfo.getPartnerId());
            if (partnerInfo != null) {
                createTime = "'" + dateTimeFormat.format(partnerInfo.getCreateTime()) + "'";
                updateTime = (partnerInfo.getUpdateTime() == null) ? "NULL" : "'" + dateTimeFormat.format(partnerInfo.getUpdateTime()) + "'";
                partnerSQL = "INSERT INTO partner_info VALUES (" +
                        partnerInfo.getId() + ", " +
                        "'" + partnerInfo.getPartnerName() + "', " +
                        +partnerInfo.getPartnerType() + ", " +
                        "'" + partnerInfo.getPartnerAddress() + "', " +
                        "'" + partnerInfo.getPartnerProvince() + "', " +
                        "'" + partnerInfo.getPartnerCity() + "', " +
                        "'" + partnerInfo.getPartnerArea() + "', " +
                        "'" + partnerInfo.getPartnerLinkMan() + "', " +
                        "'" + partnerInfo.getPartnerLinkTelephone() + "', " +
                        "'" + partnerInfo.getPartnerBussinessArea() + "', " +
                        "'" + partnerInfo.getPartnerIntroduce() + "', " +
                        "'" + partnerInfo.getPartnerUniqueCode() + "', " +
                        "0, 1, " + partnerInfo.getCreateUserId() + ", " +
                        "'" + partnerInfo.getCreateUserName() + "', " +
                        createTime + ", " +
                        +partnerInfo.getUpdateUserId() + ", " +
                        "'" + partnerInfo.getUpdateUserName() + "', " +
                        updateTime +
                        " );\n\r";
            } else {
                return "合作商信息读取失败,请重新生成SQL!";
            }
            // 6、读取服务器信息表Server_Info,生成SQL文
            createTime = "'"+ dateTimeFormat.format(partnerDockingInfo.getCreateTime())+"'";
            updateTime = (partnerDockingInfo.getUpdateTime() == null) ? "NULL" : "'"+ dateTimeFormat.format(partnerDockingInfo.getUpdateTime())+"'";
            serverSQL = "INSERT INTO server_info VALUES(" +
                    partnerDockingInfo.getId() + ", " +
                    partnerDockingInfo.getPartnerId() + ", " +
                    partnerDockingInfo.getHospitalId() + ", " +
                    partnerDockingInfo.getDepartmentId() + ", " +
                    "NULL, NULL, NULL, NULL, ";
            // 判断机器码是否为空,拼接不同的字符串。
            if ((partnerDockingInfo.getServerMachineCode() == null) || (partnerDockingInfo.getServerMachineCode().isEmpty())) {
                serverSQL += "NULL, ";
            } else {
                serverSQL += "'" + partnerDockingInfo.getServerMachineCode() + "', ";
            }
            serverSQL += "NULL, NULL, " +
                    "'" + partnerDockingInfo.getAccessKey() + "', " +
                    "0, 1, " +
                    partnerDockingInfo.getCreateUserId() + ", " +
                    "'" + partnerDockingInfo.getCreateUserName() + "', " +
                    createTime + ", " +
                    partnerDockingInfo.getUpdateUserId() + ", " +
                    "'" + partnerDockingInfo.getUpdateUserName() + "', " +
                    updateTime + " " +
                    ");\n\r";
            // 7、订单、订单明细(服务期限和数量)的数据生成
            // 7.1 订单数据
            Map<String, Object> orderMap = new HashMap<>();
            orderMap.put("hospital_id", partnerDockingInfo.getHospitalId());
            orderMap.put("department_id", partnerDockingInfo.getDepartmentId());
            orderMap.put("enabled", 1);
            orderMap.put("is_del", 0);
            List<ProductOrder> productOrderList = productOrderService.listByMap(orderMap);
            if ((productOrderList != null) && (productOrderList.size() > 0)) {
                for (int i = 0; i < productOrderList.size(); i++) {
                    ProductOrder productOrder = productOrderList.get(i);
                    createTime = "'"+dateTimeFormat.format(productOrder.getCreateTime()) +"'";
                    updateTime = (productOrder.getUpdateTime() == null) ? "NULL" : "'"+dateTimeFormat.format(productOrder.getUpdateTime())+"'";
                    serviceSQL += "INSERT INTO order_record VALUES(" +
                            productOrder.getId() + ", " +
                            productOrder.getHospitalId() + ", " +
                            "'" + productOrder.getHospitalName() + "', " +
                            productOrder.getDepartmentId() + ", " +
                            "'" + productOrder.getDepartmentName() + "', " +
                            "'" + productOrder.getContractNo() + "', " +
                            "'" + productOrder.getContractTitle() + "', " +
                            "'" + dateFormat.format(productOrder.getContractBeginTime()) + "', " +
                            "'" + dateFormat.format(productOrder.getContractEndTime()) + "', " +
                            "'" + dateTimeFormat.format(productOrder.getContractTime()) + "', " +
                            productOrder.getIsDel() + ", " +
                            productOrder.getEnabled() + ", " +
                            createTime + ", " +
                            productOrder.getCreateUserId() + ", " +
                            "'" + productOrder.getCreateUserName() + "', " +
                            updateTime + ", " +
                            productOrder.getUpdateUserId() + ", " +
                            "'" + productOrder.getUpdateUserName() + "' " +
                            ");\n\r";
                    // 7.2 订单明细数据
                    orderMap.clear();
                    orderMap.put("order_id", productOrder.getId());
                    orderMap.put("enabled", 1);
                    orderMap.put("is_del", 0);
                    List<ProductOrderRecord> productOrderRecordList = productOrderRecordService.listByMap(orderMap);
                    if ((productOrderRecordList != null) && (productOrderRecordList.size() > 0)) {
                        for (i = 0; i < productOrderRecordList.size(); i++) {
                            ProductOrderRecord productOrderRecord = productOrderRecordList.get(i);
                            createTime = "'"+dateTimeFormat.format(productOrderRecord.getCreateTime())+"'";
                            updateTime = (productOrderRecord.getUpdateTime() == null) ? "NULL" : "'"+dateTimeFormat.format(productOrderRecord.getUpdateTime())+"'";
                            serviceSQL += "INSERT INTO order_detail VALUES( " +
                                    productOrderRecord.getId() + ", " +
                                    productOrderRecord.getOrderId() + ", " +
                                    productOrderRecord.getProId() + ", " +
                                    productOrderRecord.getProType() + ", " +
                                    "'" + productOrderRecord.getProName() + "', " +
                                    productOrderRecord.getAilightCount() + ", " +
                                    productOrderRecord.getRecordCount() + ", " +
                                    "'" + dateFormat.format(productOrderRecord.getProBegintime()) + "', " +
                                    "'" + dateFormat.format(productOrderRecord.getProEndtime()) + "', " +
                                    productOrderRecord.getIsShare() + ", " +
                                    "0, 0, " +
                                    // 服务验证字符串【合作商ID、医院ID、科室ID、产品ID、开始日期、结束日期、读片数量、报告数量、已使用读片数量、已使用报告数量】
                                    "'" + EncryptUtils.encryptAES((partnerDockingInfo.getPartnerId().toString() + "|" +
                                    partnerDockingInfo.getHospitalId().toString() + "|" +
                                    partnerDockingInfo.getDepartmentId().toString() + "|" +
                                    productOrderRecord.getProId().toString() + "|" +
                                    dateFormat.format(productOrderRecord.getProBegintime()) + "|" +
                                    dateFormat.format(productOrderRecord.getProEndtime()) + "|" +
                                    productOrderRecord.getAilightCount().toString() + "|" +
                                    productOrderRecord.getRecordCount() + "|" +
                                    "0|0"), SecurityConstants.AES_KEY) + "', " +
                                    productOrderRecord.getIsDel() + ", " +
                                    productOrderRecord.getEnabled() + ", " +
                                    createTime + ", " +
                                    productOrderRecord.getCreateUserId() + ", " +
                                    "'" + productOrderRecord.getCreateUserName() + "', " +
                                    updateTime + ", " +
                                    productOrderRecord.getUpdateUserId() + ", " +
                                    "'" + productOrderRecord.getUpdateUserName() + "' " +
                                    ");\n\r";
                        }
                    } else {
                        return "没有已开通的服务记录,请先充值,再生成SQL文";
                    }
                }
            } else {
                return "没有已开通的服务记录,请先充值,再生成SQL文";
            }
            // 8、所有SQL文合并入基本的SQL中
            dbSql += hospitalSQL + departmentSQL + doctorSQL + partnerSQL + serverSQL + serviceSQL;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                fileImput.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return dbSql;
    }
    ;
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/java/com/kidgrow/oprationcenter/service/impl/PartnerInfoServiceImpl.java
New file
@@ -0,0 +1,58 @@
package com.kidgrow.oprationcenter.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.service.impl.SuperServiceImpl;
import com.kidgrow.oprationcenter.mapper.PartnerInfoMapper;
import com.kidgrow.oprationcenter.model.PartnerInfo;
import com.kidgrow.oprationcenter.service.IPartnerInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商信息表<br>
 * @Project: 运营中心<br>
 * @CreateDate: Created in 2020-12-08 14:35:30 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version 1.0
 */
@Slf4j
@Service
public class PartnerInfoServiceImpl extends SuperServiceImpl<PartnerInfoMapper, PartnerInfo> implements IPartnerInfoService {
    /**
     * 列表
     * @param params
     * @return
     */
    @Override
    public PageResult<PartnerInfo> findList(Map<String, Object> params){
        Page<PartnerInfo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
        List<PartnerInfo> list  =  baseMapper.findList(page, params);
        return PageResult.<PartnerInfo>builder().data(list).code(0).count(page.getTotal()).build();
    }
    /**
   * 根据PartnerInfo对象当做查询条件进行查询
   * @param partnerInfo
   * @return PartnerInfo
   */
    @Override
    public PartnerInfo findByObject(PartnerInfo partnerInfo){
        return baseMapper.findByObject(partnerInfo);
    }
    /**
     * 根据名称查询合作商名称列表
     * @param partnerName
     * @return
     */
    @Override
    public List<PartnerInfo> findByName(String partnerName) {
        return baseMapper.findByName(partnerName);
    }
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/PartnerDockingInfoMapper.xml
New file
@@ -0,0 +1,102 @@
<?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.kidgrow.oprationcenter.mapper.PartnerDockingInfoMapper">
    <!--定义查询列-->
    <sql id="Column_List">
       *
    </sql>
    <!--sql查询片段-->
    <sql id="where">
        <where>
            <!--查询条件自行添加-->
            is_del=0
            <if test="p.id != null and p.id !=''">
                and id = #{p.id}
            </if>
            <if test="p.partnerId != null and p.partnerId !=''">
                and partner_id = #{p.partnerId}
            </if>
            <if test="p.partnerName != null and p.partnerName !=''">
                and partner_name like CONCAT('%',#{p.partnerName},'%')
            </if>
            <if test="p.hospitalId != null and p.hospitalId !=''">
                and hospital_id = #{p.hospitalId}
            </if>
            <if test="p.hospitalName != null and p.hospitalName !=''">
                and hospital_name like CONCAT('%', #{p.hospitalName},'%')
            </if>
            <if test="p.departmentId != null and p.departmentId !=''">
                and department_id = #{p.departmentId}
            </if>
            <if test="p.departmentName != null and p.departmentName !=''">
                and department_name = #{p.departmentName}
            </if>
            <if test="p.dockingType != null and p.dockingType !=''">
                and docking_type = #{p.dockingType}
            </if>
            <if test="p.dockingVersion != null and p.dockingVersion !=''">
                and docking_version = #{p.dockingVersion}
            </if>
            <if test="p.dockingStatus != null and p.dockingStatus !=''">
                and docking_status = #{p.dockingStatus}
            </if>
            <if test="p.serverMachineCode != null and p.serverMachineCode !=''">
                and server_machine_code = #{p.serverMachineCode}
            </if>
            <if test="p.accessKey != null and p.accessKey !=''">
                and access_key = #{p.accessKey}
            </if>
            <if test="p.operationName != null and p.operationName !=''">
                and operation_name = #{p.operationName}
            </if>
            <if test="p.operationTime != null and p.operationTime !=''">
                and operation_time = #{p.operationTime}
            </if>
            <if test="p.isDel != null and p.isDel !=''">
                and is_del = #{p.isDel}
            </if>
            <if test="p.enabled != null and p.enabled !=''">
                and enabled = #{p.enabled}
            </if>
            <if test="p.createUserId != null and p.createUserId !=''">
                and create_user_id = #{p.createUserId}
            </if>
            <if test="p.createUserName != null and p.createUserName !=''">
                and create_user_name = #{p.createUserName}
            </if>
            <if test="p.createTime != null and p.createTime !=''">
                and create_time = #{p.createTime}
            </if>
            <if test="p.updateUserId != null and p.updateUserId !=''">
                and update_user_id = #{p.updateUserId}
            </if>
            <if test="p.updateUserName != null and p.updateUserName !=''">
                and update_user_name = #{p.updateUserName}
            </if>
            <if test="p.updateTime != null and p.updateTime !=''">
                and update_time = #{p.updateTime}
            </if>
        </where>
    </sql>
    <!--定义根据-PartnerDockingInfo当作查询条件返回对象-->
    <select id="findByObject" resultType="com.kidgrow.oprationcenter.model.PartnerDockingInfo">
        select
        <include refid="Column_List"/>
        from partner_docking_info
        <include refid="where"/>
        order by id desc
        limit 1
    </select>
    <!--定义根据-PartnerDockingInfo当作查询条件返回对象集合-->
    <select id="findList" resultType="com.kidgrow.oprationcenter.model.PartnerDockingInfo">
        select
        <include refid="Column_List"/>
        from partner_docking_info
        <include refid="where"/>
        order by id desc
    </select>
</mapper>
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/PartnerInfoMapper.xml
New file
@@ -0,0 +1,105 @@
<?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.kidgrow.oprationcenter.mapper.PartnerInfoMapper">
    <!--定义查询列-->
    <sql id="Column_List">
       *
    </sql>
    <!--sql查询片段-->
    <sql id="where">
        <where>
            <!--查询条件自行添加-->
            is_del=0
            <if test="p.id != null and p.id !=''">
                and id = #{p.id}
            </if>
            <if test="p.partnerName != null and p.partnerName !=''">
                and partner_name like CONCAT('%', #{p.partnerName},'%')
            </if>
            <if test="p.partnerType != null and p.partnerType !=''">
                and partner_type = #{p.partnerType}
            </if>
            <if test="p.partnerAddress != null and p.partnerAddress !=''">
                and partner_address = #{p.partnerAddress}
            </if>
            <if test="p.partnerProvince != null and p.partnerProvince !=''">
                and partner_province = #{p.partnerProvince}
            </if>
            <if test="p.partnerCity != null and p.partnerCity !=''">
                and partner_city = #{p.partnerCity}
            </if>
            <if test="p.partnerArea != null and p.partnerArea !=''">
                and partner_area = #{p.partnerArea}
            </if>
            <if test="p.partnerLinkMan != null and p.partnerLinkMan !=''">
                and partner_link_man = #{p.partnerLinkMan}
            </if>
            <if test="p.partnerLinkTelephone != null and p.partnerLinkTelephone !=''">
                and partner_link_telephone = #{p.partnerLinkTelephone}
            </if>
            <if test="p.partnerBussinessArea != null and p.partnerBussinessArea !=''">
                and partner_bussiness_area = #{p.partnerBussinessArea}
            </if>
            <if test="p.partnerIntroduce != null and p.partnerIntroduce !=''">
                and partner_introduce = #{p.partnerIntroduce}
            </if>
            <if test="p.partnerUniqueCode != null and p.partnerUniqueCode !=''">
                and partner_unique_code = #{p.partnerUniqueCode}
            </if>
            <if test="p.isDel != null and p.isDel !=''">
                and is_del = #{p.isDel}
            </if>
            <if test="p.enabled != null and p.enabled !=''">
                and enabled = #{p.enabled}
            </if>
            <if test="p.createUserId != null and p.createUserId !=''">
                and create_user_id = #{p.createUserId}
            </if>
            <if test="p.createUserName != null and p.createUserName !=''">
                and create_user_name = #{p.createUserName}
            </if>
            <if test="p.createTime != null and p.createTime !=''">
                and create_time = #{p.createTime}
            </if>
            <if test="p.updateUserId != null and p.updateUserId !=''">
                and update_user_id = #{p.updateUserId}
            </if>
            <if test="p.updateUserName != null and p.updateUserName !=''">
                and update_user_name = #{p.updateUserName}
            </if>
            <if test="p.updateTime != null and p.updateTime !=''">
                and update_time = #{p.updateTime}
            </if>
        </where>
    </sql>
    <!--定义根据-PartnerInfo当作查询条件返回对象-->
    <select id="findByObject" resultType="com.kidgrow.oprationcenter.model.PartnerInfo">
        select
        <include refid="Column_List"/>
        from partner_info
        <include refid="where"/>
        order by id desc
        limit 1
    </select>
    <!--定义根据-PartnerInfo当作查询条件返回对象集合-->
    <select id="findList" resultType="com.kidgrow.oprationcenter.model.PartnerInfo">
        select
        <include refid="Column_List"/>
        from partner_info
        <include refid="where"/>
        order by id desc
    </select>
    <!--定义根据-PartnerName当作查询条件返回对象集合-->
    <select id="findByName" resultType="com.kidgrow.oprationcenter.model.PartnerInfo">
        select id,
        partner_name
        from partner_info
        where is_del=0 and enabled=1 and partner_name LIKE concat('%',#{partnerName},'%')
        order by partner_name desc,id desc
    </select>
</mapper>
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/template/imageServer_template.sql
New file
@@ -0,0 +1,551 @@
CREATE TABLE `bonect`  (
  `UUID` char(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '唯一标识',
  `OriginName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '光片名称',
  `Sex` bit(1) NULL DEFAULT NULL COMMENT '性别。0:男,1:女',
  `Seged` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否分割。0:未分割,1:已分割',
  `AiStatus` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'AI分析结果。0:未分析,-1:无效光片,21:分析完成',
  `CreateTime` timestamp(0) NOT NULL DEFAULT current_timestamp(0) COMMENT '创建时间',
  `ReturnTime` timestamp(0)  NULL  COMMENT '结果返回时间',
  `Returned` bit(1) NOT NULL DEFAULT b'0' COMMENT '结果是否返回。0:未返回,1:已返回',
  `CompleteTime` timestamp(0)  NULL  COMMENT 'AI分析完成时间',
  `RGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `RGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `RGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `RGPT1` float NOT NULL DEFAULT 0,
  `RGPT2` float NOT NULL DEFAULT 0,
  `RGPT3` float NOT NULL DEFAULT 0,
  `CGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `CGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `CGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `CGPT1` float NOT NULL DEFAULT 0,
  `CGPT2` float NOT NULL DEFAULT 0,
  `CGPT3` float NOT NULL DEFAULT 0,
  `ZGIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIPT1` float NOT NULL DEFAULT 0,
  `ZGIPT2` float NOT NULL DEFAULT 0,
  `ZGIPT3` float NOT NULL DEFAULT 0,
  `ZGIIIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIIIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIIIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGIIIPT1` float NOT NULL DEFAULT 0,
  `ZGIIIPT2` float NOT NULL DEFAULT 0,
  `ZGIIIPT3` float NOT NULL DEFAULT 0,
  `ZGVT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGVT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGVT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGVPT1` float NOT NULL DEFAULT 0,
  `ZGVPT2` float NOT NULL DEFAULT 0,
  `ZGVPT3` float NOT NULL DEFAULT 0,
  `JJIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIPT1` float NOT NULL DEFAULT 0,
  `JJIPT2` float NOT NULL DEFAULT 0,
  `JJIPT3` float NOT NULL DEFAULT 0,
  `JJIIIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIIIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIIIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJIIIPT1` float NOT NULL DEFAULT 0,
  `JJIIIPT2` float NOT NULL DEFAULT 0,
  `JJIIIPT3` float NOT NULL DEFAULT 0,
  `JJVT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJVT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJVT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `JJVPT1` float NOT NULL DEFAULT 0,
  `JJVPT2` float NOT NULL DEFAULT 0,
  `JJVPT3` float NOT NULL DEFAULT 0,
  `ZJIIIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJIIIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJIIIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJIIIPT1` float NOT NULL DEFAULT 0,
  `ZJIIIPT2` float NOT NULL DEFAULT 0,
  `ZJIIIPT3` float NOT NULL DEFAULT 0,
  `ZJIIIBY` float NOT NULL DEFAULT 0,
  `ZJVT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJVT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJVT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZJVPT1` float NOT NULL DEFAULT 0,
  `ZJVPT2` float NOT NULL DEFAULT 0,
  `ZJVPT3` float NOT NULL DEFAULT 0,
  `ZJVBY` float NOT NULL DEFAULT 0,
  `YJIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIPT1` float NOT NULL DEFAULT 0,
  `YJIPT2` float NOT NULL DEFAULT 0,
  `YJIPT3` float NOT NULL DEFAULT 0,
  `YJIBY` float NOT NULL DEFAULT 0,
  `YJIIIT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIIIT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIIIT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJIIIPT1` float NOT NULL DEFAULT 0,
  `YJIIIPT2` float NOT NULL DEFAULT 0,
  `YJIIIPT3` float NOT NULL DEFAULT 0,
  `YJIIIBY` float NOT NULL DEFAULT 0,
  `YJVT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJVT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJVT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YJVPT1` float NOT NULL DEFAULT 0,
  `YJVPT2` float NOT NULL DEFAULT 0,
  `YJVPT3` float NOT NULL DEFAULT 0,
  `YJVBY` float NOT NULL DEFAULT 0,
  `TZGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `TZGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `TZGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `TZGPT1` float NOT NULL DEFAULT 0,
  `TZGPT2` float NOT NULL DEFAULT 0,
  `TZGPT3` float NOT NULL DEFAULT 0,
  `GGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `GGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `GGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `GGPT1` float NOT NULL DEFAULT 0,
  `GGPT2` float NOT NULL DEFAULT 0,
  `GGPT3` float NOT NULL DEFAULT 0,
  `SJGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `SJGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `SJGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `SJGPT1` float NOT NULL DEFAULT 0,
  `SJGPT2` float NOT NULL DEFAULT 0,
  `SJGPT3` float NOT NULL DEFAULT 0,
  `YGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `YGPT1` float NOT NULL DEFAULT 0,
  `YGPT2` float NOT NULL DEFAULT 0,
  `YGPT3` float NOT NULL DEFAULT 0,
  `ZGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZGPT1` float NOT NULL DEFAULT 0,
  `ZGPT2` float NOT NULL DEFAULT 0,
  `ZGPT3` float NOT NULL DEFAULT 0,
  `DDJGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `DDJGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `DDJGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `DDJGPT1` float NOT NULL DEFAULT 0,
  `DDJGPT2` float NOT NULL DEFAULT 0,
  `DDJGPT3` float NOT NULL DEFAULT 0,
  `XDJGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `XDJGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `XDJGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `XDJGPT1` float NOT NULL DEFAULT 0,
  `XDJGPT2` float NOT NULL DEFAULT 0,
  `XDJGPT3` float NOT NULL DEFAULT 0,
  `ZIGT1` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZIGT2` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZIGT3` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
  `ZIGPT1` float NOT NULL DEFAULT 0,
  `ZIGPT2` float NOT NULL DEFAULT 0,
  `ZIGPT3` float NOT NULL DEFAULT 0,
  `gpBoneAge` float NOT NULL DEFAULT -1 COMMENT 'GP骨龄',
  `Message` tinyint(4) NOT NULL DEFAULT 0 COMMENT '失败原因',
  `Source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '来源',
  PRIMARY KEY (`UUID`) USING BTREE
)  COMMENT = 'AI骨等级分析记录表' ;
CREATE TABLE `child_info`  (
  `id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '孩子唯一标识',
  `hospital_id` bigint(20) NULL COMMENT '医院的唯一标识',
  `deparment_id` bigint(20) NULL COMMENT '医院科室的唯一标识',
  `doctor_id` bigint(20) NULL COMMENT '医生的唯一标识',
  `name` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '孩子姓名',
  `sex` tinyint(1) NOT NULL COMMENT '孩子性别,0表示男孩,1表示女孩',
  `birthday` date NOT NULL COMMENT '孩子出生日期',
  `identity_card_number` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '孩子身份证号',
  `diagnose_count` int(6) NOT NULL COMMENT '孩子H端诊断次数(只加不减)',
  `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '家庭地址',
  `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '联系电话',
  `is_del` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除:0:正常 1:删除',
  `create_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_user_id` bigint(20) NULL COMMENT '创建账号的唯一标识',
  `create_user_name` varchar(50) NULL COMMENT '创建者名称',
  `update_time` datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `update_user_id` bigint(20) NULL COMMENT '更新数据的账号的唯一标识',
  `update_user_name` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新数据的用户的姓名',
  PRIMARY KEY (`id`),
  UNIQUE INDEX `pk_id`(`id`) USING BTREE COMMENT '主键唯一索引'
) COMMENT = '孩子档案信息表';
CREATE TABLE `diagnose_record`  (
  `id` varchar(36) NOT NULL COMMENT '诊断记录唯一ID',
  `hospital_id` bigint(20) NULL COMMENT '医院唯一ID',
  `department_id` bigint(20) NULL COMMENT '科室唯一ID',
  `doctor_id` bigint(20) NULL COMMENT '医生唯一ID',
  `child_id` varchar(36) NULL COMMENT '儿童档案ID',
  `diagnose_time` date NULL COMMENT '诊断日期',
  `life_age` decimal(4, 2) NULL COMMENT '诊断时的生活年龄',
  `xray_name` varchar(255) NULL COMMENT '光片名称',
  `ai_id` varchar(36) NULL COMMENT 'AI业务处理ID',
  `evaluation_status` tinyint(2) NULL DEFAULT 0 COMMENT '评价状态(1:提交AI分析;2:AI分析失败;3:AI分析成功;4:提交高级分析;5:高级分析失败:6:高级分析成功;7:自主分析;8:报告采用)',
  `generate_report` tinyint(1) NULL DEFAULT 0 COMMENT '是否生成报告(0:未生成;1:已生成)',
  `is_del` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除(1:删除,0:未删除)',
  `enable` bit(1) NOT NULL DEFAULT 1 COMMENT '是否启用(0:停用;1:启用)',
  `create_user_id` bigint(20) NULL COMMENT '创建者ID',
  `create_user_name` varchar(50) NULL COMMENT '创建者账号',
  `create_time` datetime(0) NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `update_user_id` bigint(20) NULL COMMENT '更新者ID',
  `update_user_name` varchar(50) NULL COMMENT '更新者账号',
  `update_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '诊断记录表';
CREATE TABLE `evaluation_detail`  (
  `id` bigint(20) NOT NULL COMMENT '骨龄评价序号',
  `record_id` bigint(20) NOT NULL COMMENT '评价记录ID',
  `diagnostic_id` varchar(36) NOT NULL COMMENT '诊断记录ID',
  `xray_name` varchar(255) NULL COMMENT '光片地址与名称',
  `evaluation_type` tinyint(1) NULL DEFAULT 1 COMMENT '评价方式(1:AI;2:自读;3:高级)',
  `rus_evaluation_method` tinyint(1) NULL COMMENT '评价方法(1:RUS_CHN;2:TW3-C RUS;3:TW3 RUS;4:G-P)',
  `rus_bone_age` decimal(4, 2) NULL DEFAULT 0 COMMENT 'RUS骨龄',
  `rus_bone_age_twelve` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '12进制骨龄',
  `rg_level` varchar(5) NULL COMMENT '桡骨等级',
  `rg_credible` bit(1) NULL DEFAULT 1 COMMENT '桡骨等级是否可信(1:可信;0:不可信)',
  `cg_level` varchar(5) NULL COMMENT '尺骨等级',
  `cg_credible` bit(1) NULL DEFAULT 1 COMMENT '尺骨等级是否可信(1:可信;0:不可信)',
  `zgi_level` varchar(5) NULL COMMENT '掌骨I等级',
  `zgi_credible` bit(1) NULL DEFAULT 1 COMMENT '掌骨I等级是否可信(1:可信;0:不可信)',
  `zgiii_level` varchar(5) NULL COMMENT '掌骨III等级',
  `zgiii_credible` bit(1) NULL DEFAULT 1 COMMENT '掌骨III等级是否可信(1:可信;0:不可信)',
  `zgv_level` varchar(5) NULL COMMENT '掌骨V等级',
  `zgv_credible` bit(1) NULL DEFAULT 1 COMMENT '掌骨V等级是否可信(1:可信;0:不可信)',
  `jji_level` varchar(5) NULL COMMENT '近节指骨I等级',
  `jji_credible` bit(1) NULL DEFAULT 1 COMMENT '近节指骨I等级是否可信(1:可信;0:不可信)',
  `jjiii_level` varchar(5) NULL COMMENT '近节指骨III等级',
  `jjiii_credible` bit(1) NULL DEFAULT 1 COMMENT '近节指骨III等级是否可信(1:可信;0:不可信)',
  `jjv_level` varchar(5) NULL COMMENT '近节指骨V等级',
  `jjv_credible` bit(1) NULL DEFAULT 1 COMMENT '近节指骨V等级是否可信(1:可信;0:不可信)',
  `zjiii_level` varchar(5) NULL COMMENT '中节指骨III等级',
  `zjiii_credible` bit(1) NULL DEFAULT 1 COMMENT '中节指骨III等级是否可信(1:可信;0:不可信)',
  `zjiii_mutation_rate` float NULL COMMENT '中节指骨III变异概率',
  `zjv_level` varchar(5) NULL COMMENT '中节指骨V等级',
  `zjv_credible` bit(1) NULL DEFAULT 1 COMMENT '中节指骨V等级是否可信(1:可信;0:不可信)',
  `zjv_mutation_rate` float NULL COMMENT '中节指骨V变异概率',
  `yji_level` varchar(5) NULL COMMENT '远节指骨I等级',
  `yji_credible` bit(1) NULL DEFAULT 1 COMMENT '远节指骨I等级是否可信(1:可信;0:不可信)',
  `yji_mutation_rate` float NULL COMMENT '远节指骨I变异概率',
  `yjiii_level` varchar(5) NULL COMMENT '远节指骨III等级',
  `yjiii_credible` bit(1) NULL DEFAULT 1 COMMENT '远节指骨III等级是否可信(1:可信;0:不可信)',
  `yjiii_mutation_rate` float NULL COMMENT '远节指骨III变异概率',
  `yjv_level` varchar(5) NULL COMMENT '远节指骨V等级',
  `yjv_credible` bit(1) NULL DEFAULT 1 COMMENT '远节指骨V等级是否可信(1:可信;0:不可信)',
  `yjv_mutation_rate` float NULL COMMENT '远节指骨V变异概率',
  `carpal_evaluation_method` tinyint(1) NULL COMMENT 'Carpal骨龄评价方法(1:TW3-C Carpal;2:TW3 Carpal)',
  `carpal_bone_age` decimal(4, 2) NULL DEFAULT 0 COMMENT '腕骨骨龄',
  `tzg_level` varchar(5) NULL COMMENT '头状骨等级',
  `tzg_credible` bit(1) NULL DEFAULT 1 COMMENT '头状骨等级可信度(1:可信;0:不可信)',
  `gg_level` varchar(5) NULL COMMENT '钩骨等级',
  `gg_credible` bit(1) NULL DEFAULT 1 COMMENT '钩骨等级可信度(1:可信;0:不可信)',
  `sjg_level` varchar(5) NULL COMMENT '三角骨等级',
  `sjg_credible` bit(1) NULL DEFAULT 1 COMMENT '三角骨等级可信度(1:可信;0:不可信)',
  `yg_level` varchar(5) NULL COMMENT '月骨等级',
  `yg_credible` bit(1) NULL DEFAULT 1 COMMENT '月骨等级可信度(1:可信;0:不可信)',
  `zg_level` varchar(5) NULL COMMENT '舟骨等级',
  `zg_credible` bit(1) NULL DEFAULT 1 COMMENT '舟骨等级可信度(1:可信;0:不可信)',
  `ddjg_level` varchar(5) NULL COMMENT '大多角骨等级',
  `ddjg_credible` bit(1) NULL DEFAULT 1 COMMENT '大多角骨等级可信度(1:可信;0:不可信)',
  `xdjg_level` varchar(5) NULL COMMENT '小多角骨等级',
  `xdjg_credible` bit(1) NULL DEFAULT 1 COMMENT '小多角骨骨等级可信度(1:可信;0:不可信)',
  `zig_level` varchar(5) NULL COMMENT '籽骨等级',
  `image_finding` varchar(1000) NULL COMMENT '影像表现',
  `image_impression` varchar(1000) NULL COMMENT '影像印象',
  `is_del` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除(0:未删除;1:已删除)',
  `enable` bit(1) NOT NULL DEFAULT 1 COMMENT '是否启用(0:停用;1:启用)',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建者ID',
  `create_user_name` varchar(50) NOT NULL COMMENT '创建者账号',
  `create_time` datetime NOT NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user_id` bigint(20) NULL COMMENT '更新者ID',
  `update_user_name` varchar(50) NULL COMMENT '更新者账号',
  `update_time` datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  INDEX(`record_id`, `diagnostic_id`)
) COMMENT = '骨龄评价记录明细表';
CREATE TABLE `evaluation_record`  (
  `id` bigint(20) NOT NULL COMMENT '骨龄评价序号',
  `hospital_id` bigint(20) NULL COMMENT '医院ID',
  `department_id` bigint(20) NULL COMMENT '科室ID',
  `doctor_id` bigint(20) NULL COMMENT '医生ID',
  `child_id` varchar(36) NOT NULL COMMENT '儿童档案ID',
  `diagnostic_id` varchar(36) NOT NULL COMMENT '诊断记录ID',
  `xray_name` varchar(255) NULL COMMENT '光片地址与名称',
  `xray_upload_type` tinyint(1) NULL DEFAULT 1 COMMENT 'X光片上传方式(1:web端;2:移动端;3:Pacs)',
  `evaluation_status` tinyint(2) NULL DEFAULT 0 COMMENT '评价状态(1:提交AI分析;2:AI分析失败;3:AI分析成功;4:提交高级分析;5:高级分析失败:6:高级分析成功;7:自主分析;8:报告采用)',
  `operation_time` datetime NULL COMMENT '高级读片时间',
  `operation_user_name` varchar(50) NULL COMMENT '高级读片员姓名',
  `is_del` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除(0:未删除;1:已删除)',
  `enable` bit(1) NOT NULL DEFAULT 1 COMMENT '是否启用(0:停用;1:启用)',
  `create_user_id` bigint(20) NULL COMMENT '创建者ID',
  `create_user_name` varchar(50) NULL COMMENT '创建者账号',
  `create_time` datetime(0) NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `update_user_id` bigint(20) NULL COMMENT '更新者ID',
  `update_user_name` varchar(50) NULL COMMENT '更新者账号',
  `update_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '骨龄评价记录表';
CREATE TABLE `partner_info`  (
  `id` bigint(20) NOT NULL COMMENT 'ID',
  `partner_name` varchar(50) NULL COMMENT '合作商名称',
  `partner_type` tinyint(1) NULL COMMENT '合作商类型(1:区域经销商;2:设备供应商;3:系统集成商;4:行业代理商;5:个人)',
  `partner_address` varchar(100) NULL COMMENT '合作商地址',
  `partner_province` varchar(50) NULL COMMENT '合作商所在省',
  `partner_city` varchar(50) NULL COMMENT '合作商所在市',
  `partner_area` varchar(50) NULL COMMENT '合作商所在区县',
  `partner_link_man` varchar(50) NULL COMMENT '合作商联系人',
  `partner_link_telephone` varchar(50) NULL COMMENT '合作商联系电话',
  `partner_bussiness_area` varchar(300) NULL COMMENT '合作商合作区域',
  `partner_introduce` varchar(1000) NULL COMMENT '合作商简介',
  `partner_unique_code` varchar(100) NULL COMMENT '合作商唯一标识码',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用 ',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '合作商信息表';
CREATE TABLE `order_detail`  (
  `id` bigint(20) NOT NULL COMMENT '订单明细ID',
  `order_id` bigint(20) NOT NULL COMMENT '订单id',
  `product_id` bigint(20) NOT NULL COMMENT '产品ID',
  `product_type` tinyint(1) NOT NULL COMMENT '产品类型(0:试用;1:正式)',
  `product_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品名称',
  `reading_count` int(6) NOT NULL DEFAULT 0 COMMENT '读片量',
  `report_count` int(6) NOT NULL COMMENT '报告量',
  `product_begintime` datetime(0) NULL DEFAULT NULL COMMENT '有效的开始时间',
  `product_endtime` datetime(0) NULL DEFAULT NULL COMMENT '有效的结束时间',
  `is_share` bit(1) NOT NULL COMMENT '是否共享 0否 1是',
  `used_reading_count` int(6) NOT NULL DEFAULT 0 COMMENT '已用读片量',
  `used_report_count` int(6) NULL DEFAULT 0 COMMENT '已生成报告量',
  `validate_key` varchar(500) NULL COMMENT '服务验证串',
  `is_del` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_sumption_other`(`product_id`, `order_id`) USING BTREE
)  COMMENT = '订单(充值)明细表' ;
CREATE TABLE `doctor_daily_statistics`  (
  `id` bigint(20) NOT NULL COMMENT 'ID',
  `hospital_id` bigint(20) NOT NULL COMMENT '医院ID',
  `department_id` bigint(20) NOT NULL COMMENT '科室ID',
  `doctor_id` bigint(20) NOT NULL COMMENT '医生ID',
  `item_code` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '统计项目编码(1201:报告数量;1301:读片数量)',
  `item_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '统计项目名称',
  `collect_date` date NOT NULL COMMENT '统计日期',
  `item_value` bigint(20) NULL DEFAULT NULL COMMENT '统计项目数值',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除(0:未删除;1:已删除)',
  `enable` bit(1) NULL DEFAULT b'1' COMMENT '是否启用(0:未启用;1:已启用)',
  `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID',
  `create_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者账号',
  `create_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新者ID',
  `update_user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者账号',
  `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '医生日服务统计表';
CREATE TABLE `order_record`  (
  `id` bigint(20) NOT NULL COMMENT '订单记录ID',
  `hospital_id` bigint(20) NOT NULL COMMENT '医院标识id',
  `hospital_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '医院名称',
  `department_id` bigint(20) NOT NULL COMMENT '科室ID',
  `department_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '科室名称',
  `contract_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单编号',
  `contract_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单名称',
  `contract_begin_time` datetime(0) NULL DEFAULT NULL COMMENT '订单开始日期',
  `contract_end_time` datetime(0) NULL DEFAULT NULL COMMENT '订单结束日期',
  `contract_time` datetime(0) NULL DEFAULT NULL COMMENT '订单签订时间',
  `is_del` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_sumption_other`(`hospital_id`, `department_id`) USING BTREE
)  COMMENT = '订单(充值)记录' ;
CREATE TABLE `report_content`  (
  `id` bigint(20) NOT NULL COMMENT '唯一ID',
  `hospital_id` bigint(20) NULL COMMENT '医院ID',
  `hospital_name` varchar(50) NULL COMMENT '医院名称',
  `department_id` bigint(20) NULL COMMENT '科室ID',
  `department_name` varchar(50) NULL COMMENT '科室名称',
  `doctor_id` bigint(20) NULL COMMENT '医生ID',
  `doctor_name` varchar(20) NULL COMMENT '医生姓名',
  `child_id` varchar(36) NULL COMMENT '儿童档案ID',
  `child_name` varchar(20) NULL COMMENT '儿童姓名',
  `child_sex` tinyint(1) NULL COMMENT '儿童性别(0:男;1:女)',
  `child_birthday` date NULL COMMENT '儿童出生日期',
  `image_name` varchar(255) NULL COMMENT '光片名称',
  `diagnose_id` varchar(32) NULL COMMENT '诊断记录ID',
  `report_type` tinyint(1) NULL COMMENT '1:影像检验报告\r\n2:生长发育报告',
  `report_name` varchar(20) NULL COMMENT '报告名称',
  `clinic_number` varchar(20) NULL COMMENT '门诊号',
  `bed_number` varchar(20) NULL COMMENT '床号',
  `study_number` varchar(20) NULL COMMENT '检查单号',
  `study_date` date NULL COMMENT '检查日期',
  `life_age` decimal(4, 2) NULL COMMENT '儿童生活年龄',
  `body_part_examined` varchar(50) NULL COMMENT '检查部位',
  `rus_evaluation_method` varchar(20) NULL COMMENT '掌指骨评价方法',
  `rus_bone_age` decimal(4, 2) NULL COMMENT '掌指骨骨龄',
  `rus_bone_age_twelve` varchar(50) NULL COMMENT '十二进制掌指骨骨龄',
  `rus_bone_age_percentile` varchar(8) NULL COMMENT '掌指骨骨龄百分位',
  `rus_bone_age_score` decimal(4, 0) NULL COMMENT '掌指骨骨龄成熟度得分',
  `rg_level` varchar(5) NULL COMMENT '桡骨等级',
  `cg_level` varchar(5) NULL COMMENT '尺骨等级',
  `zgi_level` varchar(5) NULL COMMENT '掌骨I等级',
  `zgiii_level` varchar(5) NULL COMMENT '掌骨III等级',
  `zgv_level` varchar(5) NULL COMMENT '掌骨V等级',
  `jji_level` varchar(5) NULL COMMENT '近节指骨I等级',
  `jjiii_level` varchar(5) NULL COMMENT '近节指骨III等级',
  `jjv_level` varchar(5) NULL COMMENT '近节指骨V等级',
  `zjiii_level` varchar(5) NULL COMMENT '中节指骨III等级',
  `zjv_level` varchar(5) NULL COMMENT '中节指骨V等级',
  `yji_level` varchar(5) NULL COMMENT '远节指骨I等级',
  `yjiii_level` varchar(5) NULL COMMENT '远节指骨III等级',
  `yjv_level` varchar(5) NULL COMMENT '远节指骨V等级',
  `carpal_evaluation_method` varchar(20) NULL COMMENT '腕骨评价方法',
  `carpal_bone_age` decimal(4, 2) NULL COMMENT '腕骨骨龄',
  `carpal_bone_age_percentile` varchar(8) NULL COMMENT '腕骨骨龄百分位',
  `carpal_bone_age_score` decimal(4, 0) NULL COMMENT '腕骨骨龄成熟度得分',
  `rus_age_resuce_capal_age_sds` varchar(8) NULL COMMENT '掌指骨骨龄减腕骨骨龄SDS',
  `tzg_level` varchar(5) NULL COMMENT '头状骨等级',
  `gg_level` varchar(5) NULL COMMENT '钩骨等级',
  `sjg_level` varchar(5) NULL COMMENT '三角骨等级',
  `yg_level` varchar(5) NULL COMMENT '月骨等级',
  `zg_level` varchar(5) NULL COMMENT '舟骨等级',
  `ddjg_level` varchar(5) NULL COMMENT '大多角骨等级',
  `xdjg_level` varchar(5) NULL COMMENT '小多角骨等级',
  `image_finding` varchar(1000) NULL COMMENT '影像表现',
  `image_impression` varchar(1000) NULL COMMENT '影像印象',
  `is_del` bit(1) NOT NULL DEFAULT 0 COMMENT '是否删除(0:未删除;1:已删除)',
  `enable` bit(1) NOT NULL DEFAULT 1 COMMENT '是否启用(0:停用;1:启用)',
  `create_user_id` bigint(20) NULL COMMENT '创建者ID',
  `create_user_name` varchar(50) NULL COMMENT '创建者账号',
  `create_time` datetime(0) NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `update_user_id` bigint(20) NULL COMMENT '更新者ID',
  `update_user_name` varchar(50) NULL COMMENT '更新者账号',
  `update_time` datetime(0) NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '报告内容表';
CREATE TABLE `server_info`  (
  `id` bigint(20) NOT NULL COMMENT 'ID',
  `partner_id` bigint(20) NULL COMMENT '合作商ID',
  `hospital_id` bigint(20) NULL COMMENT '医院ID',
  `department_id` bigint(20) NULL COMMENT '科室ID',
  `operation_system` varchar(50) NULL COMMENT '操作系统类型及版本',
  `main_board_uuid` varchar(100) NULL COMMENT '主板UUID',
  `cpu_id` varchar(100) NULL COMMENT 'CPU ID',
  `bios_serial_number` varchar(100) NULL COMMENT 'BIOS序列号',
  `machine_guid` varchar(100) NULL COMMENT '主机GUID',
  `network_card_mac` varchar(100) NULL COMMENT '网卡MAC地址',
  `hard_disk_sn` varchar(100) NULL COMMENT '硬盘序列号',
  `application_system_unique_code` varchar(500) NULL COMMENT '应用系统唯一标识符',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用 ',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) COMMENT = '服务器相关信息';
CREATE TABLE `sys_department`  (
  `id` bigint(20) NOT NULL COMMENT '科室/部门id',
  `department_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '科室/部门名称 同组织名称',
  `hospital_id` bigint(20) NOT NULL COMMENT '医院Id',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用',
  `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人账号',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `accounts_count` smallint(2) NOT NULL COMMENT '帐号数量 默认6',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_dep_other`(`department_name`) USING BTREE
) COMMENT = '科室表' ;
CREATE TABLE `sys_doctor`  (
  `id` bigint(20) NOT NULL COMMENT '医生ID',
  `hospital_id` bigint(20) NOT NULL COMMENT '所属医院ID',
  `hospital_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '医院名称',
  `department_id` bigint(20) NOT NULL COMMENT '科室ID',
  `department_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '科室名称',
  `doctor_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '医生姓名',
  `doctor_logo` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医生的头像',
  `doctor_ccie` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医生资质证书',
  `doctor_tel` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '医生联系方式',
  `doctor_password` varchar(50) NULL COMMENT '登录密码',
  `doctor_rank_id` bigint(20) NULL DEFAULT NULL COMMENT '职称ID',
  `doctor_rank` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '职称',
  `doctor_other_link` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医生其它联系方式',
  `doctor_email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医生的email',
  `doctor_about` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医生简介',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `doctor_state` bit(1) NOT NULL DEFAULT b'0' COMMENT '医生状态 1正常 0试用',
  `doctor_type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '医生类型 0H+C端都可用   1H端   2C端 默认2',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '启用禁用状态,1启用,0停用 ',
  `create_user_id` bigint(20) UNSIGNED ZEROFILL NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  `is_admin_user` bit(1) NULL DEFAULT b'0' COMMENT '是否管理帐号 0否1是',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_doctor_other`(`hospital_id`, `doctor_name`, `doctor_tel`) USING BTREE
) COMMENT = '医生信息表' ;
CREATE TABLE `sys_hospital`  (
  `id` bigint(20) NOT NULL COMMENT '医院ID',
  `hospital_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '医院名称',
  `hospital_short_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院简称',
  `hospital_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院编码',
  `hospital_type_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '医院类型ID  从字典表关联 社区/儿保等等之类',
  `hospital_type_name` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院类型 社区/儿保等等之类',
  `hospital_tel` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院电话',
  `hospital_province` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '省名称',
  `hospital_city` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '城市名称',
  `hospital_area` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院所在地区名称',
  `area_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '区号',
  `hospital_link` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院联系人',
  `hospital_adress` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院地址',
  `latitude` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所在位置纬度',
  `longitude` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所在位置经度',
  `hospital_qualified_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资质ID',
  `hospital_qualified_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资质(三甲医院)',
  `hospital_lit_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '医院logo  缩略图',
  `hospital_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '医院logo 原图',
  `hospital_adimage` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院简介图片',
  `hospital_about` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '医院简介',
  `hospital_state` tinyint(1) UNSIGNED ZEROFILL NOT NULL DEFAULT 0 COMMENT '服务状态 0试用 1正式',
  `enabled` bit(1) NULL DEFAULT b'1' COMMENT '状态,1启用,0停用 ',
  `is_del` bit(1) NULL DEFAULT b'0' COMMENT '是否删除,1删除,0未删除',
  `create_user_id` bigint(20) NOT NULL COMMENT '创建人ID',
  `create_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人账号',
  `update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人ID',
  `update_user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人账号',
  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
)  COMMENT = '医院基础信息表' ;
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/java/com/kidgrow/oprationcenter/controller/PartnerDockingInfoController.java
New file
@@ -0,0 +1,194 @@
package com.kidgrow.oprationcenter.controller;
import com.kidgrow.common.constant.SecurityConstants;
import com.kidgrow.common.controller.BaseController;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.model.ResultBody;
import com.kidgrow.common.utils.EncryptUtils;
import com.kidgrow.oprationcenter.model.PartnerDockingInfo;
import com.kidgrow.oprationcenter.service.IPartnerDockingInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @Description: 合作商客户对接信息表
 * @Project: 运营中心
 * @CreateDate: Created in 2020-12-08 14:35:33 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/partnerdockinginfo")
@Api(tags = "合作商客户对接信息表")
public class PartnerDockingInfoController extends BaseController {
    @Autowired
    private IPartnerDockingInfoService partnerDockingInfoService;
    /**
     * 列表
     */
    @ApiOperation(value = "查询列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "分页起始位置", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer")
    })
    @GetMapping
    public PageResult list(@RequestParam Map<String, Object> params) {
        if (params.size() == 0) {
            params.put("page", 1);
            params.put("limit", 10);
        }
        return partnerDockingInfoService.findList(params);
    }
    /**
     * 查询
     */
    @ApiOperation(value = "查询")
    @GetMapping("/{id}")
    public ResultBody findById(@PathVariable Long id) {
        PartnerDockingInfo model = partnerDockingInfoService.getById(id);
        return ResultBody.ok().data(model).msg("查询成功");
    }
    /**
     * 根据PartnerDockingInfo当做查询条件进行查询
     */
    @ApiOperation(value = "根据PartnerDockingInfo当做查询条件进行查询")
    @PostMapping("/query")
    public ResultBody findByObject(@RequestBody PartnerDockingInfo partnerDockingInfo) {
        PartnerDockingInfo model = partnerDockingInfoService.findByObject(partnerDockingInfo);
        return ResultBody.ok().data(model).msg("查询成功");
    }
    /**
     * 新增or更新
     */
    @ApiOperation(value = "保存")
    @PostMapping
    public ResultBody save(@Valid @RequestBody PartnerDockingInfo partnerDockingInfo, BindingResult bindingResult) {
        List<String> errMsg = new ArrayList<>();
        if (bindingResult.hasErrors()) {
            for (ObjectError error : bindingResult.getAllErrors()) {
                errMsg.add(error.getDefaultMessage());
            }
            return ResultBody.failed().msg(errMsg.toString());
        } else {
            // 为产品制作服务器识别码
            String accessKey = "";
            // 若服务器机器码不为空,则根据合作商、医院、科室、服务器机器码生成识别码。
            if ((partnerDockingInfo.getServerMachineCode() != null)  && (!partnerDockingInfo.getServerMachineCode().isEmpty())){
                accessKey = EncryptUtils.encryptAES((partnerDockingInfo.getPartnerId().toString() + "|" + partnerDockingInfo.getHospitalId().toString() + "|" + partnerDockingInfo.getDepartmentId().toString() + "|" + partnerDockingInfo.getServerMachineCode()), SecurityConstants.AES_KEY);
            }
            // 若服务器机器码为空,则根据合作商、医院、科室生成识别码。
            else {
                accessKey = EncryptUtils.encryptAES((partnerDockingInfo.getPartnerId().toString() + "|" + partnerDockingInfo.getHospitalId().toString() + "|" + partnerDockingInfo.getDepartmentId().toString()), SecurityConstants.AES_KEY);
            }
            partnerDockingInfo.setAccessKey(accessKey);
            boolean v = partnerDockingInfoService.saveOrUpdate(partnerDockingInfo);
            if (v) {
                return ResultBody.ok().data(partnerDockingInfo).msg("保存成功");
            } else {
                return ResultBody.failed().msg("保存失败");
            }
        }
    }
    /**
     * 更新状态
     */
    @ApiOperation(value = "更新状态")
    @PostMapping("/updatestatus")
    public ResultBody updateStatus(@RequestBody PartnerDockingInfo partnerDockingInfo) {
        boolean v = partnerDockingInfoService.saveOrUpdate(partnerDockingInfo);
        if (v) {
            return ResultBody.ok().data(partnerDockingInfo).msg("状态更新成功");
        } else {
            return ResultBody.failed().data("状态更新失败");
        }
    }
    /**
     * 删除
     */
    @ApiOperation(value = "删除")
    @DeleteMapping("/{id}")
    public ResultBody delete(@PathVariable Long id) {
        boolean v = partnerDockingInfoService.removeById(id);
        if (v) {
            return ResultBody.ok().msg("删除成功");
        } else {
            return ResultBody.failed().msg("删除失败");
        }
    }
    /**
     * 创建该客户所需的私有云数据库脚本
     *
     * @param partnerDockingInfo
     * @return
     */
    @ApiOperation(value = "创建并下载私有云数据库脚本")
    @PostMapping("/downloaddb")
    public void downLoadDataBase(@RequestBody PartnerDockingInfo partnerDockingInfo, HttpServletResponse response) {
        String dbSql = partnerDockingInfoService.createSQL(partnerDockingInfo);
        OutputStream out = null;
        InputStream fileInputStream = null;
        try {
            //BASE64Decoder dencoder = new BASE64Decoder();
            byte[] arr = dbSql.getBytes();
            // 设置输出的格式
            response.reset();
            response.setContentType("application/x-msdownload");
            response.addHeader("Content-Length", "" + arr.length);
            response.addHeader("Content-Disposition", "attachment; filename=\"" + partnerDockingInfo.getHospitalName()+partnerDockingInfo.getDepartmentName() + ".sql\"");
            out = response.getOutputStream();
            fileInputStream = new ByteArrayInputStream(arr);
            byte[] buffer = new byte[1024 * 10] ;
            int len = 0;
            while ((len = fileInputStream.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (fileInputStream != null) {
                try {
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/java/com/kidgrow/oprationcenter/controller/PartnerInfoController.java
New file
@@ -0,0 +1,152 @@
package com.kidgrow.oprationcenter.controller;
import com.kidgrow.common.constant.SecurityConstants;
import com.kidgrow.common.controller.BaseController;
import com.kidgrow.common.model.PageResult;
import com.kidgrow.common.model.ResultBody;
import com.kidgrow.common.utils.EncryptUtils;
import com.kidgrow.oprationcenter.model.PartnerInfo;
import com.kidgrow.oprationcenter.service.IPartnerInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 * @Description: 合作商信息表
 * @Project: 运营中心
 * @CreateDate: Created in 2020-12-08 14:35:30 <br>
 * @Author: <a href="1024030301@kidgrow.com">LuLiQiang</a>
 * @version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/partnerinfo")
@Api(tags = "合作商信息表")
public class PartnerInfoController  extends BaseController{
    @Autowired
    private IPartnerInfoService partnerInfoService;
    /**
     * 列表
     */
    @ApiOperation(value = "查询列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "分页起始位置", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer")
    })
    @GetMapping
    public PageResult list(@RequestParam Map<String, Object> params) {
        if(params.size()==0){
            params.put("page",1);
            params.put("limit",10);
        }
        return partnerInfoService.findList(params);
    }
    /**
     * 查询
     */
    @ApiOperation(value = "查询")
    @GetMapping("/{id}")
    public ResultBody findById(@PathVariable Long id) {
        PartnerInfo model = partnerInfoService.getById(id);
        return ResultBody.ok().data(model).msg("查询成功");
    }
    /**
     * 根据PartnerInfo当做查询条件进行查询
     */
    @ApiOperation(value = "根据PartnerInfo当做查询条件进行查询")
    @PostMapping("/query")
    public ResultBody findByObject(@RequestBody PartnerInfo partnerInfo) {
        PartnerInfo model = partnerInfoService.findByObject(partnerInfo);
        return ResultBody.ok().data(model).msg("查询成功");
    }
    /**
     * 查询
     */
    @ApiOperation(value = "查询")
    @GetMapping("/findByName")
    public ResultBody findByName(@RequestParam String partnerName) {
        if (!partnerName.isEmpty()) {
            return ResultBody.ok().data(partnerInfoService.findByName(partnerName)).msg("查询成功");
        } else {
            return ResultBody.ok().data(null).msg("");
        }
    }
    /**
     * 新增or更新
     */
    @ApiOperation(value = "保存")
    @PostMapping
    public ResultBody save(@Valid @RequestBody PartnerInfo partnerInfo, BindingResult bindingResult) {
        List<String> errMsg= new ArrayList<>();
        if (bindingResult.hasErrors()) {
            for (ObjectError error : bindingResult.getAllErrors()) {
                errMsg.add(error.getDefaultMessage());
            }
            return ResultBody.failed().msg(errMsg.toString());
        } else {
            // 数据更新
            if (partnerInfo.getId() != null){
                boolean v= partnerInfoService.saveOrUpdate(partnerInfo);
                if(v) {
                    return ResultBody.ok().data(partnerInfo).msg("保存成功");
                }
                else {
                    return ResultBody.failed().msg("保存失败");
                }
            }
            // 数据新增
            else {
                boolean v= partnerInfoService.saveOrUpdate(partnerInfo);
                if(v) {
                    // 为合作商制作识别码【AES(ID)】
                    String uniqueCode = EncryptUtils.encryptAES(partnerInfo.getId().toString(), SecurityConstants.AES_KEY);
                    partnerInfo.setPartnerUniqueCode(uniqueCode);
                    v= partnerInfoService.saveOrUpdate(partnerInfo);
                    if(v) {
                        return ResultBody.ok().data(partnerInfo).msg("保存成功");
                    }
                    else {
                        return ResultBody.failed().msg("保存失败");
                    }
                }
                else {
                    return ResultBody.failed().msg("保存失败");
                }
            }
        }
    }
    /**
     * 删除
     */
    @ApiOperation(value = "删除")
    @DeleteMapping("/{id}")
    public ResultBody delete(@PathVariable Long id) {
        boolean v= partnerInfoService.removeById(id);
        if(v) {
            return ResultBody.ok().msg("删除成功");
        }
        else {
            return ResultBody.failed().msg("删除失败");
        }
    }
}
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-server/src/main/resources/application.yml
@@ -95,6 +95,8 @@
      - equipment_docking
      - hospital_screening
      - screening_organization_info
      - partner_info
      - partner_docking_info
    ignoreSqls:
      - com.kidgrow.usercenter.mapper.SysRoleMapper.findAll
      - com.kidgrow.oprationcenter.mapper.ConsumptionRecordMapper.findDetailList
kidgrow-commons/kidgrow-common-spring-boot-starter/src/main/java/com/kidgrow/common/constant/SecurityConstants.java
@@ -207,4 +207,10 @@
     * rsa公钥
     */
    String RSA_PUBLIC_KEY = "pubkey.txt";
    /**
     * AES 加解密 Key
     */
    String AES_KEY= "Kidgrow@2801";
}
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/partnerDockingInfo.html
New file
@@ -0,0 +1,407 @@
<div class="layui-card">
    <div class="layui-card-header">
        <h2 class="header-title">合作商客户对接管理</h2>
        <span class="layui-breadcrumb pull-right">
            <a href="#!console">首页</a>
            <a><cite>合作商客户对接管理</cite></a>
        </span>
    </div>
    <div class="layui-card-body">
        <div class="layui-form toolbar">
            搜索:
            <input id="partnerName-search" class="layui-input search-input" type="text" placeholder="按合作商名称" />&emsp;
            <input id="hospitalName-search" class="layui-input search-input" type="text" placeholder="按医院名称" />&emsp;
            <button id="partnerDockingInfo-btn-search" class="layui-btn icon-btn  permissions"
                permissions="partnerDockingInfo-list"><i class="layui-icon">&#xe615;</i>搜索</button>
            <button id="partnerDockingInfo-btn-add" class="layui-btn icon-btn  permissions"
                permissions="partnerDockingInfo-edit"><i class="layui-icon">&#xe654;</i>添加</button>
        </div>
        <!-- 数据表格 -->
        <table class="layui-table" id="partnerDockingInfo-table" lay-filter="partnerDockingInfo-table"></table>
    </div>
</div>
<!-- 表格操作列 -->
<script type="text/html" id="partnerDockingInfo-table-bar">
    <a class="layui-btn layui-btn-primary layui-btn-xs permissions" permissions="partnerDockingInfo-edit" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger  layui-btn-xs permissions" permissions="partnerDockingInfo-del" lay-event="del">删除</a>
    <a class="layui-btn layui-btn-xs permissions" permissions="partnerDockingInfo-download" lay-event="download">下载数据库脚本</a>
</script>
<!-- 表格状态列 -->
<script type="text/html" id="partnerDockingInfo-status">
    <input type="checkbox" lay-filter="partnerDockingInfo-status" value="{{d.id}}" lay-skin="switch" lay-text="启用|暂停"
           {{d.dockingStatus==1?'checked':''}} class="permissions" permissions="partnerDockingInfo-status"/>
</script>
<!-- 新增/修改表单弹窗 -->
<script type="text/html" id="partnerDockingInfo-model">
    <form id="partnerDockingInfo-form" lay-filter="partnerDockingInfo-form" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px;">合作商名称</label>
            <div class="layui-input-inline" style="width: 200px;">
                <!-- <input name="partnerName" id="partnerName" placeholder="请输入合作商名称" lay-verify="required" required
                       type="text" class="layui-input" maxlength="100" style="width: 200px;"/> -->
                    <select id="partnerId" name="partnerId" lay-filter="partnerId" placeholder="请选择合作商"
                       lay-verify="required" required >
                   <option value="">-请选择合作商-</option>
               </select>
                <input type="hidden" name="partnerName" id="partnerName"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px;">医院名称</label>
            <div class="layui-input-block" style="width: 250px;">
                <input name="hospitalName" id="hospitalName" placeholder="请输入医院名称"lay-verify="required" required
                        type="text" class="layui-input" maxlength="100"  style="width: 200px;"/>
                <input type="hidden" name="hospitalId" id="hospitalId"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px;">科室</label>
            <div class="layui-input-inline" style="width: 200px;">
                <select id="departmentId" name="departmentId" lay-filter="departmentId" placeholder="请选择科室"
                        lay-verify="required" required >
                    <option value="">-请选择科室-</option>
                </select>
                <input name="departmentName" id="departmentName"  type="hidden" />
            </div>
        </div>
        <!-- 对接类型,默认为1:影像版API-->
        <!-- <input name="dockingType" id="partnerType" type="hidden" value="1" /> -->
        <div class="layui-form-item">
           <label class="layui-form-label"  style="width: 100px;">对接类型</label>
            <div class="layui-input-inline"style="width: 200px;">
                <input name="dockingTypeName" id="partnerTypeName" type="hidden" value="1" />
                <select name="dockingType" id="partnerType" lay-filter="dockingType"
                        style="width: 50px;">
                    <option value="">请选择</option>
                    <option value="1" selected>影像版API</option>
                    <option value="2">妇幼版API</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px" >对接系统版本</label>
            <div class="layui-input-block"  style="width:250px;">
                <input name="dockingVersion" lay-verify="required" required type="text" class="layui-input" maxlength="30" style="width: 200px;"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:100px" >服务器机器码</label>
            <div class="layui-input-block"  style="width:250px;">
                <input name="serverMachineCode"  type="text" class="layui-input" maxlength="100" style="width: 200px;"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px;">安装人</label>
            <div class="layui-input-block" style="width: 250px;">
                <input name="operationName" lay-verify="required" required type="text" class="layui-input" maxlength="30"style="width: 200px;"/>
            </div>
        </div>
        <div class="layui-form-item model-form-footer">
            <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
            <button class="layui-btn" id="sure" lay-filter="partnerDockingInfo-form-submit" permissions="
            partnerDocking-edit" lay-submit>保存
            </button>
        </div>
    </form>
</script>
<script>
    layui.use(['form', 'table', 'util', 'config', 'admin', 'autocomplete', 'laydate'], function () {
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var layer = layui.layer;
        var util = layui.util;
        var admin = layui.admin;
        var laydate = layui.laydate;
        var autocomplete = layui.autocomplete;
        var $ = layui.jquery;
        // 添加按钮点击事件
        $('#partnerDockingInfo-btn-add').click(function () {
            showEditModel(undefined, 1);
        });
        //// 刷新
        // $('#docto-templete-btn-update').click(function () {
        //     table.reload('app-table', { where: {} });
        // });
        //渲染表格
        table.render({
            elem: '#partnerDockingInfo-table',
            url: config.base_server + 'api-opration/partnerdockinginfo',
            method: 'GET',
            headers: { 'Authorization': 'Bearer ' + config.getToken().access_token },
            page: true,
            cols: [[
                { field: 'partnerName', align: 'center', width: '10%', title: '合作商名称' },
                { field: 'hospitalName', align: 'center', width: '15%', title: '医院名称' },
                { field: 'departmentName', align: 'center', width: '7%', title: '科室名称' },
                {
                    field: 'dockingType', align: 'center', width: '7%', title: '对接类型', templet: function (d) {
                        if (d.dockingType == null) {
                            return "";
                        } else if (d.dockingType == 1) {
                            return "影像版API";
                        } else if (d.dockingType == 2) {
                            return "妇幼版API";
                        } else {
                            return "";
                        }
                    }
                },
                { field: 'dockingVersion', align: 'center', width: '5%', title: '对接版本' },
                { field: 'dockingStatus', align: 'center', width: '7%', templet: '#partnerDockingInfo-status', title: '状态' },
                { field: 'serverMachineCode', align: 'center', width: '10%', title: '服务器机器码' },
                { field: 'accessKey', align: 'center', width: '10%', title: 'AccessKey' },
                { field: 'operationName', align: 'center', width: '7%', title: '对接操作人' },
                { field: 'operationTime', align: 'center', width: '7%', title: '对接日期', templet: "<div>{{layui.util.toDateString(d.operationTime, 'yyyy/MM/dd')}}</div>" },
                { field: 'Id', align: 'center', toolbar: '#partnerDockingInfo-table-bar', title: '操作', width: '15%', fixed: 'right' }
            ]]
        });
        // 工具条点击事件
        table.on('tool(partnerDockingInfo-table)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') { // 查看详情
                showEditModel(data, 2);
            } else if (layEvent === 'del') {
                layer.confirm('确定删除此合作商客户对接信息吗?', function (i) {
                    layer.close(i);
                    layer.load(2);
                    admin.req('api-opration/partnerdockinginfo/' + obj.data.id, {}, function (data) {
                        layer.closeAll('loading');
                        if (data.code == 0) {
                            layer.msg(data.msg, { icon: 1, time: 2000 });
                            table.reload('partnerDockingInfo-table', {});
                        } else {
                            layer.msg(data.msg, { icon: 2, time: 2000 });
                        }
                    }, 'delete');
                });
            } else if (layEvent == 'download') {
                var url = config.base_server + "api-opration/partnerdockinginfo/downloaddb/";
                // 获取XMLHttpRequest
                var xmlResquest = new XMLHttpRequest();
                //  发起请求
                xmlResquest.open("POST", url, true);
                // 设置请求头类型
                xmlResquest.setRequestHeader("Content-type", "application/json");
                xmlResquest.setRequestHeader("Authorization", "Bearer " + config.getToken().access_token);
                xmlResquest.responseType = "blob";
                var jsondata = JSON.stringify(obj.data);
                //  返回
                xmlResquest.onload = function () {
                    if (this.status == 200) {
                        var fileName = data.hospitalName+data.departmentName+".sql";
                        var blob = this.response;
                        var a = document.createElement('a');
                        a.innerHTML = fileName;
                        // 指定生成的文件名
                        a.download = fileName;
                        a.href = URL.createObjectURL(blob);
                        document.body.appendChild(a);
                        var evt = document.createEvent("MouseEvents");
                        evt.initEvent("click", false, false);
                        a.dispatchEvent(evt);
                        document.body.removeChild(a);
                    }
                };
                xmlResquest.send(jsondata);
            }
        });
        // 搜索按钮点击事件
        $('#partnerDockingInfo-btn-search').click(function () {
            var partnerName = $('#partnerName-search').val();
            var hospitalName = $('#hospitalName-search').val();
            table.reload('partnerDockingInfo-table', { where: { partnerName: partnerName, hospitalName: hospitalName }, page: { curr: 1 } });
        });
        // 修改客户对接状态
        form.on('switch(partnerDockingInfo-status)', function (obj) {
            layer.load(2);
            admin.req('api-opration/partnerdockinginfo/updatestatus', JSON.stringify({
                id: obj.elem.value,
                dockingStatus: obj.elem.checked ? 1 : 2
            }), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, { icon: 1, time: 2000 });
                    table.reload('app-tablepartnerDockingInfo-table', {});
                } else {
                    layer.msg(data.msg, { icon: 2, time: 2000 });
                    $(obj.elem).prop('checked', !obj.elem.checked);
                    form.render('checkbox');
                }
            }, 'POST');
        });
        //合作商选择赋值
        form.on("select(partnerId)", function (data) {
            $("#partnerName").val(data.elem[data.elem.selectedIndex].text);
        })
        //赋值对接类型ID
        form.on("select(dockingType)", function (data) {
            $("#dockingTypeName").val(data.elem[data.elem.selectedIndex].text);
        });
        //新增 和  更新   科室触发的事件
        form.on('select(departmentId)', function () {
            //将部门名称赋值
            $('#departmentName').val($(this)[0].innerHTML);
        });
        // 表单提交事件
        form.on('submit(partnerDockingInfo-form-submit)', function (data) {
            layer.load(2);
            admin.req('api-opration/partnerdockinginfo', JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    // layer.msg(data.msg, { icon: 1, time: 2000 });
                    layer.closeAll();
                    table.reload('partnerDockingInfo-table', {});
                } else {
                    layer.msg(data.msg, { icon: 2, time: 2000 });
                }
            }, "POST");
            return false;
        });
        // // 显示编辑弹窗
        var showEditModel = function (data, index) {
            var title = "";
            if (index == 1) {
                title = "新增";
            } else if (index == 2) {
                title = "修改";
            }
            layer.open({
                type: 1,
                title: title,
                area: '550px',
                offset: '120px',
                content: $('#partnerDockingInfo-model').html(),
                success: function () {
                    $('#partnerDockingInfo-form')[0].reset();
                    $('#partnerDockingInfo-form').attr('method', 'POST');
                    if (data) {
                        // if (index == 1) {
                        //     $('#sure').hide();
                        // }
                        //加载合作商列表信息
                        loadPartnerInfoList(data.partnerId);
                        //重新装载科室
                        getdepartment(data.hospitalId);
                        form.val('partnerDockingInfo-form', data);
                        form.render();
                    } else {
                        //加载合作商列表信息
                        loadPartnerInfoList();
                    }
                    //自动完成-医院名称
                    autocomplete.render({
                        elem: $('#hospitalName')[0],
                        url: config.base_server + 'api-user/syshospital/findByName',
                        keywordsName: 'hospitalName', //查询关键字名称
                        template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段
                        template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板
                        onselect: function (resp) {
                            $("#hospitalId").val(resp.id);
                            //重新装载科室
                            getdepartment(resp.id);
                        }
                    });
                    //执行一个laydate实例
                    laydate.render({
                        elem: '#operationTime' //指定元素
                        , type: 'datetime'
                    });
                }
            });
        };
        //加载合作商信息列表
        var loadPartnerInfoList = function (selectVal) {
            admin.req('api-opration/partnerinfo', {
                limit: 100,
                page: 1
            }, function (data) {
                layer.closeAll('loading');
                if (0 === data.code) {
                    if (data.data.length > 0) {
                        $.each(data.data, function (index, item) {
                            //往下拉菜单里添加元素
                            $('#partnerId').append(new Option(item.partnerName, item.id,
                                false, (!strUtil.isEmpty(selectVal) && selectVal == item.id)));
                        });
                    }
                } else {
                    layer.msg(data.msg, {
                        icon: 2,
                        time: 2000
                    });
                }
            }, 'get');
        }
        //获取科室
        var getdepartment = function (data) {
            admin.req('api-user/sysdepartment/findListByHospitalId', {
                id: data
            }, function (data) {
                layer.closeAll('loading');
                if (0 === data.code) {
                    //department = data.data;
                    $('#departmentId').empty();
                    if (data.data.length > 0) {
                        $('#departmentName').val(data.data[0].departmentName);
                    }
                    $.each(data.data, function (index, item) {
                        //往下拉菜单里添加元素
                        $('#departmentId').append(new Option(item.departmentName, item.id,
                            false, false));
                        form.render('select', 'partnerDockingInfo-form');
                    })
                    form.render();
                } else {
                    layer.msg(data.msg, {
                        icon: 2,
                        time: 2000
                    });
                }
            }, 'get');
        }
    });
</script>
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/partnerInfo.html
New file
@@ -0,0 +1,363 @@
<div class="layui-card">
    <div class="layui-card-header">
        <h2 class="header-title">合作商管理</h2>
        <span class="layui-breadcrumb pull-right">
            <a href="#!console">首页</a>
            <a><cite>合作商管理</cite></a>
        </span>
    </div>
    <div class="layui-card-body">
        <div class="layui-form toolbar">
            搜索:
            <input name="partnerName" id="partnerName-serch" placeholder="按合作商名称" type="text"
                class="layui-input search-input" maxlength="50" />&emsp;
            <select id="province" placeholder="省份" lay-filter="province">
            </select>
            <select id="city" placeholder="市" lay-filter="city">
                <option value="">选择市</option>
            </select>
            <select id="area" placeholder="区县" lay-filter="areas">
                <option value="">选择区县</option>
            </select>
            <button id="partnerInfo-btn-search" class="layui-btn icon-btn permissions" permissions="partnerInfo-list"><i
                    class="layui-icon">&#xe615;</i>搜索
            </button>
            <button id="partnerInfo-btn-add" class="layui-btn icon-btn permissions" permissions="partnerInfo-edit"><i
                    class="layui-icon">&#xe654;</i>添加
            </button>
        </div>
        <!-- 数据表格 -->
        <table class="layui-table permissions" permissions="partnerInfo-list" id="partnerInfo-table"
            lay-filter="partnerInfo-table"></table>
    </div>
</div>
<!-- 表格操作列 -->
<script type="text/html" id="partnerInfo-bar">
    <a class="layui-btn layui-btn-primary layui-btn-xs permissions" permissions="partnerInfo-edit"
       lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-xs permissions" permissions="partnerInfo-del" lay-event="del">删除</a>
</script>
<!-- 表单弹窗 -->
<script type="text/html" id="app-model">
    <form id="app-form" lay-filter="app-form" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">合作商名称</label>
            <div class="layui-input-block">
                <input name="partnerName" lay-verify="required" required type="text" class="layui-input" maxlength="50"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">合作商类型</label>
            <div class="layui-input-block">
                <!-- <input name="partnerTypeName" id="partnerTypeName" type="hidden" value=""/> -->
                <select name="partnerType" id="partnerType" lay-filter="partnerTypeName"
                        style="width: 50px;">
                    <option value="">请选择</option>
                    <option value="1">区域经销商</option>
                    <option value="2">设备供应商</option>
                    <option value="3">系统集成商</option>
                    <option value="4">行业代理商</option>
                    <option value="5">个人</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row">
                <label class="layui-form-label">地址</label>
                <div class="layui-input-block">
                    <div class="layui-col-sm4">
                        <select lay-verify="required" required id="partnerProvince" placeholder="省份"
                                lay-filter="partnerProvince" style="width: 400px;">
                        </select></div>
                    <div class="layui-col-sm4">
                        <select id="partnerCity" lay-verify="required" required placeholder="市"
                                lay-filter="partnerCity"
                                style="width: 350px;">
                            <option value="">选择市</option>
                        </select></div>
                    <div class="layui-col-sm4">
                        <select id="partnerArea" lay-verify="required" required placeholder="区县"
                                lay-filter="partnerArea"
                                style="width: 350px;">
                            <option value="">选择区县</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
<!--            <label class="layui-form-label">地址</label>-->
            <div class="layui-input-block">
                <input name="partnerAddress" type="text" class="layui-input" maxlength="100"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系人</label>
            <div class="layui-input-block">
                <input name="partnerLinkMan" lay-verify="required" required type="text" class="layui-input" maxlength="20"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-block">
                <input name="partnerLinkTelephone" lay-verify="required|phone" required type="text" class="layui-input" maxlength="20"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">合作区域</label>
            <div class="layui-input-block">
                <input name="partnerBussinessArea" lay-verify="required" required type="text" class="layui-input" maxlength="100"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">简介</label>
            <div class="layui-input-block">
                <textArea name="partnerIntroduce" class="layui-textarea" maxlength="300"/>
            </div>
        </div>
        <div class="layui-form-item model-form-footer">
            <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
            <button class="layui-btn" lay-filter="partnerInfo-form-submit" permissions="
            partner-info-edit" lay-submit>保存
            </button>
        </div>
    </form>
</script>
<script>
    layui.use(['form', 'table', 'config', 'layer', 'util', 'admin', 'area', 'autocomplete'], function () {
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var layer = layui.layer;
        var util = layui.util;
        var admin = layui.admin;
        var area = layui.area;
        var autocomplete = layui.autocomplete;
        var laydate = layui.laydate;
        // //省份数据加载
        // area.areaData("#partnerProvince", 1, "", "");
        // //装载市区数据
        // form.on("select(partnerProvince)", function (data) {
        //     area.areasClear("#partnerlArea", 3);
        //     area.areaData("#partnerCity", 2, data.value, "");
        // });
        // //装载区县数据
        // form.on("select(partnerCity)", function (data) {
        //     area.areaData("#partnerArea", 3, data.value, "");
        // });
        //省份数据加载
        area.areaData("#province", 1, "", "");
        //装载市区数据
        form.on("select(province)", function (data) {
            area.areasClear("#area", 3);
            area.areaData("#city", 2, data.value, "");
        });
        //装载区县数据
        form.on("select(city)", function (data) {
            area.areaData("#area", 3, data.value, "");
        });
        // 添加按钮点击事件
        $('#partnerInfo-btn-add').click(function () {
            showEditModel(undefined, 1);
        });
        //// 刷新
        $('#partnerInfo-btn-update').click(function () {
            table.reload('partnerInfo-table', { where: {} });
        });
        //渲染表格
        table.render({
            elem: '#partnerInfo-table',
            url: config.base_server + 'api-opration/partnerinfo',
            method: 'GET',
            headers: { 'Authorization': 'Bearer ' + config.getToken().access_token },
            page: true,
            cols: [[
                { field: 'partnerName', align: 'left', width: '10%', title: '名称' },
                {
                    field: 'partnerType', align: 'left', width: '10%', title: '类型', templet: function (d) {
                        if (d.partnerType == null) {
                            return "";
                        } else if (d.partnerType == 1) {
                            return "区域经销商";
                        } else if (d.partnerType == 2) {
                            return "设备供应商";
                        } else if (d.partnerType == 3) {
                            return "系统集成商";
                        } else if (d.partnerType == 4) {
                            return "行业代理商";
                        } else if (d.partnerType == 5) {
                            return "个人";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    field: 'partnerAddress', align: 'left', width: '20%', title: '地址', templet: function (d) {
                        return ((d.partnerProvince == null) ? "" : d.partnerProvince) + " " +
                            ((d.partnerCity == null) ? "" : d.partnerCity) + " " +
                            ((d.partnerArea == null) ? "" : d.partnerArea) + " " +
                            ((d.partnerAddress == null) ? "" : d.partnerAddress)
                    }
                },
                { field: 'partnerLinkMan', align: 'left', width: '7%', title: '联系人' },
                { field: 'partnerLinkTelephone', align: 'left', width: '7%', title: '联系电话' },
                { field: 'partnerBussinessArea', align: 'left', width: '15%', title: '合作区域' },
                { field: 'partnerUniqueCode', align: 'left', width: '10%', title: '标识码' },
                {
                    field: 'createTime',
                    align: 'center',
                    width: '10%',
                    title: '创建日期',
                    templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd')}}</div>"
                },
                { field: 'id', align: 'center', width: '10%', toolbar: '#partnerInfo-bar', title: '操作', fixed: 'right' }
            ]],
            done: function (res) {
                permissionsInput(res, config);
            }
        });
        // 工具条点击事件
        table.on('tool(partnerInfo-table)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') { // 查看详情
                showEditModel(data, 2);
            } else if (layEvent === 'del') {
                layer.confirm('确定删除此合作商吗?', function (i) {
                    layer.close(i);
                    layer.load(2);
                    admin.req('api-opration/partnerinfo/' + obj.data.id, {}, function (data) {
                        layer.closeAll('loading');
                        if (data.code == 0) {
                            layer.msg(data.msg, { icon: 1, time: 2000 });
                            table.reload('partnerInfo-table', {});
                        } else {
                            layer.msg(data.msg, { icon: 2, time: 2000 });
                        }
                    }, 'delete');
                });
            }
        });
        // 搜索按钮点击事件
        $('#partnerInfo-btn-search').click(function () {
            var partnerName = $('#partnerName-serch').val();
            var partnerProvince = $("#province option:selected").text() != "选择省" ?
                $("#province option:selected").text() : "";
            var partnerCity = $("#city option:selected").text() != "选择市" ? $(
                "#city option:selected").text() : "";
            var partnerArea = $("#area option:selected").text() != "选择区县" ? $(
                "#area option:selected").text() : "";
            table.reload('partnerInfo-table', { where: { partnerName: partnerName, partnerProvince: partnerProvince, partnerCity: partnerCity, partnerArea: partnerArea }, page: { curr: 1 } });
        });
        // 表单提交事件
        form.on('submit(partnerInfo-form-submit)', function (data) {
            layer.load(2);
            if (data.field != null) {
                data.field.partnerProvince = $("#partnerProvince option:selected").text() != "选择省" ?
                    $("#partnerProvince option:selected").text() : "";
                data.field.partnerCity = $("#partnerCity option:selected").text() != "选择市" ? $(
                    "#partnerCity option:selected").text() : "";
                data.field.partnerArea = $("#partnerArea option:selected").text() != "选择区县" ? $(
                    "#partnerArea option:selected").text() : "";
                admin.req('api-opration/partnerinfo', JSON.stringify(data.field), function (data) {
                    layer.closeAll('loading');
                    if (data.code == 0) {
                        // layer.msg(data.msg, { icon: 1, time: 2000 });
                        layer.closeAll();
                        table.reload('partnerInfo-table', {});
                    } else {
                        layer.msg(data.msg, { icon: 2, time: 2000 });
                    }
                }, "POST");
            }
            return false;
        });
        // 显示编辑弹窗
        var showEditModel = function (data, index) {
            var title = "";
            if (index == 1) {
                title = "新增";
            } else if (index == 2) {
                title = "修改";
            }
            layer.open({
                type: 1,
                title: title,
                area: '450px',
                offset: '120px',
                content: $('#app-model').html(),
                success: function () {
                    $('#app-form')[0].reset();
                    $('#app-form').attr('method', 'POST');
                    if (data) {
                        // if (index == 1) {
                        //     $('#sure').hide();
                        // }
                        form.val('app-form', data);
                        //装载省市区数据
                        if (!strUtil.isEmpty(data.partnerProvince))
                            area.areaData("#partnerProvince", 1, "", data.partnerProvince);
                        if (!strUtil.isEmpty(data.partnerCity))
                            area.areaData("#partnerCity", 2, $("#partnerProvince").val(), data
                                .partnerCity);
                        if (!strUtil.isEmpty(data.partnerArea))
                            area.areaData("#partnerArea", 3, $("#partnerCity").val(), data
                                .partnerArea);
                        form.render();
                    } else {
                        //省份数据加载
                        area.areaData("#partnerProvince", 1, "", "");
                        //装载市区数据
                        form.on("select(partnerProvince)", function (data) {
                            area.areasClear("#partnerlArea", 3);
                            area.areaData("#partnerCity", 2, data.value, "");
                        });
                        //装载区县数据
                        form.on("select(partnerCity)", function (data) {
                            area.areaData("#partnerArea", 3, data.value, "");
                        });
                    }
                    //执行一个laydate实例
                    laydate.render({
                        elem: '#startTime' //指定元素
                        , type: 'datetime'
                    });
                }
            });
        };
    });
</script>