zhaops пре 4 година
родитељ
комит
7865a62cb9

+ 178 - 0
cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java

@@ -0,0 +1,178 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 科室映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-12
+ */
+@TableName("tran_dept_config")
+public class DeptConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name="HIS名称", width = 40)
+    private String hisName;
+
+    /**
+     * 医院项目编码
+     */
+    @Excel(name = "HIS编码", width = 40)
+    private String hisCode;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准名称", width = 40)
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    @Excel(name="标准编码", width = 40)
+    private String uniqueCode;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Long hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+    public String getHisName() {
+        return hisName;
+    }
+
+    public void setHisName(String hisName) {
+        this.hisName = hisName;
+    }
+    public String getHisCode() {
+        return hisCode;
+    }
+
+    public void setHisCode(String hisCode) {
+        this.hisCode = hisCode;
+    }
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+    public String getUniqueCode() {
+        return uniqueCode;
+    }
+
+    public void setUniqueCode(String uniqueCode) {
+        this.uniqueCode = uniqueCode;
+    }
+
+    @Override
+    public String toString() {
+        return "DeptConfig{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", hospitalId=" + hospitalId +
+            ", hisName=" + hisName +
+            ", hisCode=" + hisCode +
+            ", uniqueName=" + uniqueName +
+            ", uniqueCode=" + uniqueCode +
+        "}";
+    }
+}

+ 275 - 0
cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java

@@ -0,0 +1,275 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.DeptConfigService;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.DeptConfigListVO;
+import com.diagbot.vo.DeptConfigPageVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 14:25
+ */
+@Component
+public class DeptConfigFacade {
+    @Autowired
+    private DeptConfigService deptConfigService;
+
+    /**
+     * 判断是否已存在
+     *
+     * @param deptConfig
+     * @return
+     */
+    public Boolean isExistRecord(DeptConfig deptConfig) {
+        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
+        DeptConfig oldRecord = new DeptConfig();
+        if (deptConfig.getId() != null) {
+            oldRecord = deptConfigService.getById(deptConfig.getId());
+            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
+                return true;
+            }
+        }
+        if (StringUtil.isNotBlank(deptConfig.getHisName())) {
+            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", deptConfig.getHospitalId())
+                    .eq("his_name", deptConfig.getHisName())
+                    .eq("unique_name", deptConfig.getUniqueName());
+            oldRecord = deptConfigService.getOne(queryWrapper);
+            if (oldRecord != null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 保存记录-单条
+     *
+     * @param deptConfig
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(DeptConfig deptConfig) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        deptConfig.setModifier(userId);
+        deptConfig.setGmtModified(now);
+        //新增数据
+        if (deptConfig.getId() == null) {
+            deptConfig.setCreator(userId);
+            deptConfig.setGmtCreate(now);
+        }
+        if (deptConfig.getIsDeleted() == null) {
+            deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+        }
+        deptConfigService.saveOrUpdate(deptConfig);
+        return true;
+    }
+
+    /**
+     * 保存记录-批量
+     *
+     * @param deptConfigListVO
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(DeptConfigListVO deptConfigListVO) {
+        if (ListUtil.isEmpty(deptConfigListVO.getDeptConfigList())) {
+            return false;
+        }
+        return saveOrUpdateRecords(deptConfigListVO.getDeptConfigList());
+    }
+
+    /**
+     * 批量保存
+     *
+     * @param deptConfigList
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(List<DeptConfig> deptConfigList) {
+        if (ListUtil.isEmpty(deptConfigList)) {
+            return false;
+        }
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //数据不完整的不保存
+        //过滤外部名称或公表名为空的数据
+        deptConfigList = deptConfigList
+                .stream()
+                .filter(i -> i.getHospitalId() != null)
+                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(deptConfigList)) {
+            return false;
+        }
+
+        Long hospitalId = deptConfigList.get(0).getHospitalId();
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, Long>> configMap
+                = getConfigMap(hospitalId, null, null);
+        deptConfigList.forEach(deptConfig -> {
+            deptConfig.setModifier(userId);
+            deptConfig.setGmtModified(now);
+            if (deptConfig.getId() == null) {
+                if (configMap.containsKey(deptConfig.getHisName())) {
+                    deleteIds.add(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
+                }
+                deptConfig.setCreator(userId);
+                deptConfig.setGmtCreate(now);
+            }
+            if (deptConfig.getIsDeleted() == null) {
+                deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        deptConfigService.saveOrUpdateBatch(deptConfigList);
+        return true;
+    }
+
+    /**
+     * 删除记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public Boolean deleteRecord(IdVO idVO) {
+        UpdateWrapper<DeptConfig> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", idVO.getId())
+                .set("is_deleted", IsDeleteEnum.Y.getKey());
+        deptConfigService.removeById(idVO.getId());
+        return true;
+    }
+
+    /**
+     * 删除记录-批量
+     *
+     * @param idListVO
+     * @return
+     */
+    public Boolean deleteRecords(IdListVO idListVO) {
+        if (ListUtil.isEmpty(idListVO.getIds())) {
+            return false;
+        }
+        UpdateWrapper<DeptConfig> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", idListVO.getIds())
+                .set("is_deleted", IsDeleteEnum.Y.getKey());
+        deptConfigService.removeByIds(idListVO.getIds());
+        return true;
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param deptConfigPageVO
+     * @return
+     */
+    public IPage<DeptConfig> getPage(DeptConfigPageVO deptConfigPageVO) {
+        return deptConfigService.getPage(deptConfigPageVO);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalIdVO
+     */
+    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
+        List<DeptConfig> deptConfigList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
+        if (ListUtil.isNotEmpty(deptConfigList)) {
+            deptConfigList.forEach(deptConfig -> {
+                deptConfig.setHospitalId(hospitalIdVO.getHospitalId());
+            });
+            saveOrUpdateRecords(deptConfigList);
+        }
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, Long>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Long>> retMap = new HashMap<>();
+        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<DeptConfig> records = deptConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<DeptConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<DeptConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "uniqueName", "id"));
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
+        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalIdVO.getHospitalId());
+        List<DeptConfig> records = deptConfigService.list(queryWrapper);
+        String fileName = "药品映射.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
+        return deptConfigService.getRelationNumPage(hosRelationNumPageVO);
+    }
+}

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/mapper/DeptConfigMapper.java

@@ -0,0 +1,35 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.vo.DeptConfigPageVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 科室映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-12
+ */
+public interface DeptConfigMapper extends BaseMapper<DeptConfig> {
+    /**
+     * 分页查询
+     *
+     * @param deptConfigPageVO
+     * @return
+     */
+    IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/service/DeptConfigService.java

@@ -0,0 +1,35 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.vo.DeptConfigPageVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 科室映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-12
+ */
+public interface DeptConfigService extends IService<DeptConfig> {
+    /**
+     * 分页查询
+     *
+     * @param deptConfigPageVO
+     * @return
+     */
+    IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 43 - 0
cdssman-service/src/main/java/com/diagbot/service/impl/DeptConfigServiceImpl.java

@@ -0,0 +1,43 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.mapper.DeptConfigMapper;
+import com.diagbot.service.DeptConfigService;
+import com.diagbot.vo.DeptConfigPageVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 科室映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-12
+ */
+@Service
+public class DeptConfigServiceImpl extends ServiceImpl<DeptConfigMapper, DeptConfig> implements DeptConfigService {
+    /**
+     * 分页查询
+     *
+     * @param deptConfigPageVO
+     * @return
+     */
+    public IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO) {
+        return baseMapper.getPage(deptConfigPageVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
+        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
+    }
+}

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/vo/DeptConfigListVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.DeptConfig;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 11:44
+ */
+@Getter
+@Setter
+public class DeptConfigListVO {
+    private List<DeptConfig> deptConfigList;
+}

+ 40 - 0
cdssman-service/src/main/java/com/diagbot/vo/DeptConfigPageVO.java

@@ -0,0 +1,40 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/12 11:43
+ */
+@Getter
+@Setter
+public class DeptConfigPageVO extends Page {
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+
+    /**
+     * his名称
+     */
+    private String hisName;
+    /**
+     * his编码
+     */
+    private String hisCode;
+
+    /**
+     * 标准名
+     */
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    private String uniqueCode;
+}

+ 171 - 0
cdssman-service/src/main/java/com/diagbot/web/DeptConfigController.java

@@ -0,0 +1,171 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.facade.DeptConfigFacade;
+import com.diagbot.vo.DeptConfigListVO;
+import com.diagbot.vo.DeptConfigPageVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 科室映射表 前端控制器
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-12
+ */
+@RestController
+@RequestMapping("/tran/deptConfig")
+@Api(value = "科室公表映射API", tags = { "科室公表映射API" })
+public class DeptConfigController {
+    @Autowired
+    private DeptConfigFacade deptConfigFacade;
+
+    /**
+     * 映射关系是否已存在
+     *
+     * @param deptConfig
+     * @return
+     */
+    @ApiOperation(value = "映射关系是否已存在[by:zhaops]", notes = "")
+    @PostMapping("/isExistRecord")
+    @SysLogger("isExistRecord")
+    public RespDTO<Boolean> isExistRecord(@RequestBody @Valid DeptConfig deptConfig) {
+        Boolean data = deptConfigFacade.isExistRecord(deptConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 保存或修改映射关系
+     *
+     * @param deptConfig
+     * @return
+     */
+    @ApiOperation(value = "保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecord")
+    @SysLogger("saveOrUpdateRecord")
+    public RespDTO<Boolean> saveOrUpdateRecord(@RequestBody @Valid DeptConfig deptConfig) {
+        Boolean data = deptConfigFacade.saveOrUpdateRecord(deptConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量保存或修改映射关系
+     *
+     * @param deptConfigListVO
+     * @return
+     */
+    @ApiOperation(value = "批量保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecords")
+    @SysLogger("saveOrUpdateRecords")
+    public RespDTO<Boolean> saveOrUpdateRecords(@RequestBody @Valid DeptConfigListVO deptConfigListVO) {
+        Boolean data = deptConfigFacade.saveOrUpdateRecords(deptConfigListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 删除映射关系
+     *
+     * @param idVO
+     * @return
+     */
+    @ApiOperation(value = "删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecord")
+    @SysLogger("deleteRecord")
+    public RespDTO<Boolean> deleteRecord(@RequestBody @Valid IdVO idVO) {
+        Boolean data = deptConfigFacade.deleteRecord(idVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量删除映射关系
+     *
+     * @param idListVO
+     * @return
+     */
+    @ApiOperation(value = "批量删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecords")
+    @SysLogger("deleteRecords")
+    public RespDTO<Boolean> deleteRecords(@RequestBody @Valid IdListVO idListVO) {
+        Boolean data = deptConfigFacade.deleteRecords(idListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param deptConfigPageVO
+     * @return
+     */
+    @ApiOperation(value = "分页查询[by:zhaops]", notes = "")
+    @PostMapping("/getPage")
+    @SysLogger("getPage")
+    public RespDTO<DeptConfig> getPage(@RequestBody @Valid DeptConfigPageVO deptConfigPageVO) {
+        IPage<DeptConfig> data = deptConfigFacade.getPage(deptConfigPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalIdVO
+     * @return
+     */
+    @ApiOperation(value = "数据导入[by:zhaops]",
+            notes = "")
+    @PostMapping("/importExcel")
+    @SysLogger("importExcel")
+    public void importExcel(@RequestParam("file") MultipartFile file, @RequestBody @Valid HospitalIdVO hospitalIdVO) {
+        deptConfigFacade.importExcel(file, hospitalIdVO);
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    @ApiOperation(value = "数据导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcel")
+    @SysLogger("exportExcel")
+    public void exportExcel(HttpServletResponse response, @RequestBody @Valid HospitalIdVO hospitalIdVO) {
+        deptConfigFacade.exportExcel(response, hospitalIdVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    @ApiOperation(value = "各医院映射关系数列表[by:zhaops]",
+            notes = "")
+    @PostMapping("/getRelationNumPage")
+    @SysLogger("getRelationNumPage")
+    public RespDTO<IPage<HosRelationNumDTO>> getRelationNumPage(@RequestBody @Valid HosRelationNumPageVO hosRelationNumPageVO) {
+        IPage<HosRelationNumDTO> data = deptConfigFacade.getRelationNumPage(hosRelationNumPageVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 58 - 0
cdssman-service/src/main/resources/mapper/DeptConfigMapper.xml

@@ -0,0 +1,58 @@
+<?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.diagbot.mapper.DeptConfigMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.DeptConfig">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="his_name" property="hisName" />
+        <result column="his_code" property="hisCode" />
+        <result column="unique_name" property="uniqueName" />
+        <result column="unique_code" property="uniqueCode" />
+    </resultMap>
+
+    <!-- 分页查询 -->
+    <select id="getPage" resultType="com.diagbot.entity.DeptConfig">
+        select a.*
+        from tran_dept_config a
+        where a.is_deleted='N'
+        <if test="deptConfigPageVO.hospitalId!=null">
+            and a.hospital_id=#{deptConfigPageVO.hospitalId}
+        </if>
+        <if test="deptConfigPageVO.hisName!=null and deptConfigPageVO.hisName!=''">
+            and a.his_name like concat("%",#{deptConfigPageVO.hisName},"%")
+        </if>
+        <if test="deptConfigPageVO.hisCode!=null and deptConfigPageVO.hisCode!=''">
+            and a.his_code like concat("%",#{deptConfigPageVO.hisCode},"%")
+        </if>
+        <if test="deptConfigPageVO.uniqueName!=null and deptConfigPageVO.uniqueName!=''">
+            and a.unique_name like concat("%",#{deptConfigPageVO.uniqueName},"%")
+        </if>
+        <if test="deptConfigPageVO.uniqueCode!=null and deptConfigPageVO.uniqueCode!=''">
+            and a.unique_code like concat("%",#{deptConfigPageVO.uniqueCode},"%")
+        </if>
+    </select>
+
+    <!-- 各医院映射关系数列表 -->
+    <select id="getRelationNumPage" resultType="com.diagbot.dto.HosRelationNumDTO">
+        SELECT
+        a.id,
+        a.NAME,
+        sum( b.id IS NOT NULL ) AS num
+        FROM
+        tran_hospital_info a
+        LEFT JOIN tran_dept_config b ON a.id = b.hospital_id
+        AND b.is_deleted = 'N'
+        WHERE
+        a.is_deleted = 'N'
+        GROUP BY
+        a.id
+    </select>
+
+</mapper>