科室导入及标准科室
This commit is contained in:
parent
8f31ab72b8
commit
3ab9d2a39c
BIN
postdischarge-admin/src/main/resources/template/科室信息导入表.xlsx
Normal file
BIN
postdischarge-admin/src/main/resources/template/科室信息导入表.xlsx
Normal file
Binary file not shown.
@ -153,4 +153,9 @@ public class Constants {
|
||||
* 机构信息导入标识
|
||||
*/
|
||||
public static final String AGENCY = "agency";
|
||||
|
||||
/**
|
||||
* 科室信息导入标识
|
||||
*/
|
||||
public static final String DEPARTMENT = "department";
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xinelu.manage.controller.department;
|
||||
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
@ -9,12 +10,15 @@ import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import com.xinelu.manage.dto.DepartmentDto;
|
||||
import com.xinelu.manage.service.department.IDepartmentService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 科室信息Controller
|
||||
@ -121,4 +125,29 @@ public class DepartmentController extends BaseController {
|
||||
List<DepartmentDto> list = departmentService.selectDepartmentListWechatTemplateNum(departmentDto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入科室信息
|
||||
*
|
||||
* @param file 模板文件
|
||||
* @return 导入结果
|
||||
* @throws Exception 异常信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:agency:importStationInfo')")
|
||||
@Log(title = "导入科室信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/insertDepartmentList")
|
||||
public AjaxResult insertDepartmentList(MultipartFile file) throws Exception {
|
||||
//判断excel里面是否有数据/文件格式
|
||||
if (Objects.isNull(file) || StringUtils.isBlank(file.getOriginalFilename())) {
|
||||
return AjaxResult.error("请选择需要导入的文件!");
|
||||
}
|
||||
// 获取文件名
|
||||
String orgName = file.getOriginalFilename();
|
||||
if (!orgName.endsWith(Constants.XLSX) && !orgName.endsWith(Constants.XLS)) {
|
||||
return AjaxResult.error("导入文件格式不正确,请导入xlsx或xls格式的文件!");
|
||||
}
|
||||
ExcelUtil<Department> util = new ExcelUtil<>(Department.class);
|
||||
List<Department> list = util.importExcel(file.getInputStream());
|
||||
return departmentService.insertDepartmentList(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class DepartmentDiseaseTypeController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:departmentDisease:add')")
|
||||
@Log(title = "科室病种信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DepartmentDiseaseType departmentDiseaseType) {
|
||||
return toAjax(departmentDiseaseTypeService.insertDepartmentDiseaseType(departmentDiseaseType));
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class DepartmentDiseaseTypeController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:departmentDisease:edit')")
|
||||
@Log(title = "科室病种信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DepartmentDiseaseType departmentDiseaseType) {
|
||||
return toAjax(departmentDiseaseTypeService.updateDepartmentDiseaseType(departmentDiseaseType));
|
||||
}
|
||||
|
||||
@ -41,6 +41,9 @@ public class ImportDownloadController {
|
||||
if (fileType.equals(Constants.AGENCY)) {
|
||||
file = ResourceUtils.getFile("classpath:template/机构信息导入表.xlsx");
|
||||
}
|
||||
if (fileType.equals(Constants.DEPARTMENT)) {
|
||||
file = ResourceUtils.getFile("classpath:template/科室信息导入表.xlsx");
|
||||
}
|
||||
if (Objects.isNull(file)) {
|
||||
throw new ServiceException("下载导入模板文件失败,请联系管理员!");
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package com.xinelu.manage.controller.normdepartmentcompare;
|
||||
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.normdepartmentcompare.NormDepartmentCompare;
|
||||
import com.xinelu.manage.service.normdepartmentcompare.INormDepartmentCompareService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标准科室对照信息Controller
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/compare")
|
||||
public class NormDepartmentCompareController extends BaseController {
|
||||
@Resource
|
||||
private INormDepartmentCompareService normDepartmentCompareService;
|
||||
|
||||
/**
|
||||
* 查询标准科室对照信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(NormDepartmentCompare normDepartmentCompare) {
|
||||
startPage();
|
||||
List<NormDepartmentCompare> list = normDepartmentCompareService.selectNormDepartmentCompareList(normDepartmentCompare);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出标准科室对照信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:export')")
|
||||
@Log(title = "标准科室对照信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, NormDepartmentCompare normDepartmentCompare) {
|
||||
List<NormDepartmentCompare> list = normDepartmentCompareService.selectNormDepartmentCompareList(normDepartmentCompare);
|
||||
ExcelUtil<NormDepartmentCompare> util = new ExcelUtil<NormDepartmentCompare>(NormDepartmentCompare.class);
|
||||
util.exportExcel(response, list, "标准科室对照信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标准科室对照信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(normDepartmentCompareService.selectNormDepartmentCompareById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标准科室对照信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:add')")
|
||||
@Log(title = "标准科室对照信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody NormDepartmentCompare normDepartmentCompare) {
|
||||
return toAjax(normDepartmentCompareService.insertNormDepartmentCompare(normDepartmentCompare));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改标准科室对照信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:edit')")
|
||||
@Log(title = "标准科室对照信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody NormDepartmentCompare normDepartmentCompare) {
|
||||
return toAjax(normDepartmentCompareService.updateNormDepartmentCompare(normDepartmentCompare));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标准科室对照信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:compare:remove')")
|
||||
@Log(title = "标准科室对照信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(normDepartmentCompareService.deleteNormDepartmentCompareByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -99,8 +99,8 @@ public class Department extends BaseEntity {
|
||||
/**
|
||||
* 节点类型,科室:DEPARTMENT,病区:WARD,
|
||||
*/
|
||||
@ApiModelProperty(value = "节点类型,科室:DEPARTMENT,病区:WARD,")
|
||||
@Excel(name = "节点类型,科室:DEPARTMENT,病区:WARD,")
|
||||
@ApiModelProperty(value = "节点类型,科室:DEPARTMENT,病区:WARD")
|
||||
@Excel(name = "节点类型,科室:DEPARTMENT,病区:WARD")
|
||||
private String nodeType;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
package com.xinelu.manage.domain.normdepartmentcompare;
|
||||
|
||||
import com.xinelu.common.annotation.Excel;
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 标准科室对照信息对象 norm_department_compare
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-28
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "标准科室对照信息对象", description = "norm_department_compare")
|
||||
public class NormDepartmentCompare extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属科室id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属科室id")
|
||||
@Excel(name = "所属科室id")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 所属科室名称
|
||||
*/
|
||||
@ApiModelProperty(value = "所属科室名称")
|
||||
@Excel(name = "所属科室名称")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 标准对照名称
|
||||
*/
|
||||
@ApiModelProperty(value = "标准对照名称")
|
||||
@Excel(name = "标准对照名称")
|
||||
private String normCompareName;
|
||||
|
||||
/**
|
||||
* 标准对照编码
|
||||
*/
|
||||
@ApiModelProperty(value = "标准对照编码")
|
||||
@Excel(name = "标准对照编码")
|
||||
private String normCompareCode;
|
||||
|
||||
/**
|
||||
* 标准对照排序
|
||||
*/
|
||||
@ApiModelProperty(value = "标准对照排序")
|
||||
@Excel(name = "标准对照排序")
|
||||
private Integer normCompareSort;
|
||||
|
||||
/**
|
||||
* 标准对照概述
|
||||
*/
|
||||
@ApiModelProperty(value = "标准对照概述")
|
||||
@Excel(name = "标准对照概述")
|
||||
private String normCompareRemark;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("departmentId", getDepartmentId())
|
||||
.append("departmentName", getDepartmentName())
|
||||
.append("normCompareName", getNormCompareName())
|
||||
.append("normCompareCode", getNormCompareCode())
|
||||
.append("normCompareSort", getNormCompareSort())
|
||||
.append("normCompareRemark", getNormCompareRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.department;
|
||||
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import com.xinelu.manage.dto.DepartmentDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -85,4 +86,20 @@ public interface DepartmentMapper {
|
||||
*/
|
||||
List<DepartmentDto> selectDepartmentListWechatTemplateNum(DepartmentDto departmentDto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有的机构信息
|
||||
*
|
||||
* @param departmentNames 机构信息集合
|
||||
* @return 列表集合信息
|
||||
*/
|
||||
List<Department> getAllDepartmentInfo(@Param("departmentNames") List<String> departmentNames);
|
||||
|
||||
/**
|
||||
* 科室信息导入
|
||||
*
|
||||
* @param departmentList 机构信息
|
||||
* @return int
|
||||
**/
|
||||
int insertDepartmentList(List<Department> departmentList);
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xinelu.manage.mapper.normdepartmentcompare;
|
||||
|
||||
import com.xinelu.manage.domain.normdepartmentcompare.NormDepartmentCompare;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 标准科室对照信息Mapper接口
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-28
|
||||
*/
|
||||
public interface NormDepartmentCompareMapper {
|
||||
/**
|
||||
* 查询标准科室对照信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 标准科室对照信息
|
||||
*/
|
||||
NormDepartmentCompare selectNormDepartmentCompareById(Long id);
|
||||
|
||||
/**
|
||||
* 查询标准科室对照信息列表
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 标准科室对照信息集合
|
||||
*/
|
||||
List<NormDepartmentCompare> selectNormDepartmentCompareList(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 新增标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 修改标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 删除标准科室对照信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteNormDepartmentCompareById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除标准科室对照信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteNormDepartmentCompareByIds(Long[] ids);
|
||||
}
|
||||
@ -165,9 +165,9 @@ public class AgencyServiceImpl implements IAgencyService {
|
||||
}
|
||||
List<String> agencyNames = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getAgencyName())).map(Agency::getAgencyName).distinct().collect(Collectors.toList());
|
||||
//根据名称查询护理站基本信息
|
||||
List<Agency> allNurseStationInfo = agencyMapper.getAllAgencyInfo(agencyNames);
|
||||
List<Agency> allAgencyInfo = agencyMapper.getAllAgencyInfo(agencyNames);
|
||||
//做差集,去除数据库中已经存在的护理站信息
|
||||
List<Agency> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allNurseStationInfo));
|
||||
List<Agency> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allAgencyInfo));
|
||||
if (CollectionUtils.isEmpty(subtractList)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.service.department;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import com.xinelu.manage.dto.DepartmentDto;
|
||||
|
||||
@ -84,4 +85,12 @@ public interface IDepartmentService {
|
||||
* @return
|
||||
*/
|
||||
List<DepartmentDto> selectDepartmentListWechatTemplateNum(DepartmentDto departmentDto);
|
||||
|
||||
/**
|
||||
* 科室信息导入
|
||||
*
|
||||
* @param departmentList 科室信息
|
||||
* @return int
|
||||
**/
|
||||
AjaxResult insertDepartmentList(List<Department> departmentList);
|
||||
}
|
||||
|
||||
@ -1,14 +1,27 @@
|
||||
package com.xinelu.manage.service.department.impl;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.DateUtils;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
import com.xinelu.common.utils.regex.RegexUtil;
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import com.xinelu.manage.dto.DepartmentDto;
|
||||
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
||||
import com.xinelu.manage.service.department.IDepartmentService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -21,6 +34,8 @@ import java.util.List;
|
||||
public class DepartmentServiceImpl implements IDepartmentService {
|
||||
@Resource
|
||||
private DepartmentMapper departmentMapper;
|
||||
@Resource
|
||||
private RegexUtil regexUtil;
|
||||
|
||||
/**
|
||||
* 查询科室信息
|
||||
@ -93,7 +108,7 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
/**
|
||||
* 查询科室信息列表及包含话术数量
|
||||
*
|
||||
* @param department
|
||||
* @param departmentDto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -122,4 +137,50 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
public List<DepartmentDto> selectDepartmentListWechatTemplateNum(DepartmentDto departmentDto) {
|
||||
return departmentMapper.selectDepartmentListWechatTemplateNum(departmentDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室信息导入
|
||||
*
|
||||
* @param departmentList 科室信息
|
||||
* @return 导入结果
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult insertDepartmentList(List<Department> departmentList) {
|
||||
//判断添加的数据是否为空
|
||||
if (CollectionUtils.isEmpty(departmentList)) {
|
||||
return AjaxResult.error("请添加科室导入信息!");
|
||||
}
|
||||
//根据护理站名称做去除处理
|
||||
List<Department> importDataList = departmentList.stream().filter(item -> StringUtils.isNotBlank(item.getDepartmentName())).distinct().collect(Collectors.toList());
|
||||
//校验联系电话格式是否正确
|
||||
Department department = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getDepartmentPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getDepartmentPhone()))).findFirst().orElse(new Department());
|
||||
if (StringUtils.isNotBlank(department.getDepartmentPhone())) {
|
||||
return AjaxResult.error("当前科室电话:" + department.getDepartmentPhone() + " 格式不正确,请重新录入!");
|
||||
}
|
||||
List<String> departmentName = importDataList.stream().filter(item -> StringUtils.isNotBlank(item.getDepartmentName())).map(Department::getDepartmentName).distinct().collect(Collectors.toList());
|
||||
//根据名称查询护理站基本信息
|
||||
List<Department> allDepartment = departmentMapper.getAllDepartmentInfo(departmentName);
|
||||
//做差集,去除数据库中已经存在的护理站信息
|
||||
List<Department> subtractList = new ArrayList<>(CollectionUtils.subtract(importDataList, allDepartment));
|
||||
if (CollectionUtils.isEmpty(subtractList)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<Department> saveDepartmentList = new ArrayList<>();
|
||||
for (Department item : subtractList) {
|
||||
if (Objects.isNull(item.getParentDepartmentId())) {
|
||||
item.setParentDepartmentId(0L);
|
||||
}
|
||||
item.setCreateBy(SecurityUtils.getUsername());
|
||||
item.setCreateTime(new Date());
|
||||
Department newDepartment = new Department();
|
||||
BeanUtils.copyProperties(item, newDepartment);
|
||||
saveDepartmentList.add(newDepartment);
|
||||
}
|
||||
int insertCount = departmentMapper.insertDepartmentList(saveDepartmentList);
|
||||
if (insertCount <= 0) {
|
||||
throw new ServiceException("导入科室信息失败,请联系管理员!");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xinelu.manage.service.normdepartmentcompare;
|
||||
|
||||
import com.xinelu.manage.domain.normdepartmentcompare.NormDepartmentCompare;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 标准科室对照信息Service接口
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-28
|
||||
*/
|
||||
public interface INormDepartmentCompareService {
|
||||
/**
|
||||
* 查询标准科室对照信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 标准科室对照信息
|
||||
*/
|
||||
NormDepartmentCompare selectNormDepartmentCompareById(Long id);
|
||||
|
||||
/**
|
||||
* 查询标准科室对照信息列表
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 标准科室对照信息集合
|
||||
*/
|
||||
List<NormDepartmentCompare> selectNormDepartmentCompareList(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 新增标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 修改标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare);
|
||||
|
||||
/**
|
||||
* 批量删除标准科室对照信息
|
||||
*
|
||||
* @param ids 需要删除的标准科室对照信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteNormDepartmentCompareByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除标准科室对照信息信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteNormDepartmentCompareById(Long id);
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.xinelu.manage.service.normdepartmentcompare.impl;
|
||||
|
||||
import com.xinelu.common.utils.DateUtils;
|
||||
import com.xinelu.manage.domain.normdepartmentcompare.NormDepartmentCompare;
|
||||
import com.xinelu.manage.mapper.normdepartmentcompare.NormDepartmentCompareMapper;
|
||||
import com.xinelu.manage.service.normdepartmentcompare.INormDepartmentCompareService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 标准科室对照信息Service业务层处理
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-02-28
|
||||
*/
|
||||
@Service
|
||||
public class NormDepartmentCompareServiceImpl implements INormDepartmentCompareService {
|
||||
@Resource
|
||||
private NormDepartmentCompareMapper normDepartmentCompareMapper;
|
||||
|
||||
/**
|
||||
* 查询标准科室对照信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 标准科室对照信息
|
||||
*/
|
||||
@Override
|
||||
public NormDepartmentCompare selectNormDepartmentCompareById(Long id) {
|
||||
return normDepartmentCompareMapper.selectNormDepartmentCompareById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询标准科室对照信息列表
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 标准科室对照信息
|
||||
*/
|
||||
@Override
|
||||
public List<NormDepartmentCompare> selectNormDepartmentCompareList(NormDepartmentCompare normDepartmentCompare) {
|
||||
return normDepartmentCompareMapper.selectNormDepartmentCompareList(normDepartmentCompare);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare) {
|
||||
normDepartmentCompare.setCreateTime(DateUtils.getNowDate());
|
||||
return normDepartmentCompareMapper.insertNormDepartmentCompare(normDepartmentCompare);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改标准科室对照信息
|
||||
*
|
||||
* @param normDepartmentCompare 标准科室对照信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNormDepartmentCompare(NormDepartmentCompare normDepartmentCompare) {
|
||||
normDepartmentCompare.setUpdateTime(DateUtils.getNowDate());
|
||||
return normDepartmentCompareMapper.updateNormDepartmentCompare(normDepartmentCompare);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除标准科室对照信息
|
||||
*
|
||||
* @param ids 需要删除的标准科室对照信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNormDepartmentCompareByIds(Long[] ids) {
|
||||
return normDepartmentCompareMapper.deleteNormDepartmentCompareByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标准科室对照信息信息
|
||||
*
|
||||
* @param id 标准科室对照信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNormDepartmentCompareById(Long id) {
|
||||
return normDepartmentCompareMapper.deleteNormDepartmentCompareById(id);
|
||||
}
|
||||
}
|
||||
@ -53,6 +53,17 @@ public class SysAreaVO implements Serializable {
|
||||
*/
|
||||
private String streetCode;
|
||||
|
||||
|
||||
/**
|
||||
* 社区名称
|
||||
*/
|
||||
private String communityName;
|
||||
|
||||
/**
|
||||
* 社区区域编码
|
||||
*/
|
||||
private String communityCode;
|
||||
|
||||
/**
|
||||
* 街道区域编码
|
||||
*/
|
||||
|
||||
@ -220,6 +220,39 @@
|
||||
d.department_code
|
||||
</select>
|
||||
|
||||
<select id="getAllDepartmentInfo" resultType="com.xinelu.manage.domain.department.Department">
|
||||
select id,
|
||||
parent_department_id,
|
||||
agency_id,
|
||||
agency_name,
|
||||
department_name,
|
||||
department_code,
|
||||
department_type,
|
||||
department_abbreviation,
|
||||
department_person_id,
|
||||
department_person_name,
|
||||
node_type,
|
||||
provide_service_category,
|
||||
subdivision_category_id,
|
||||
subdivision_category_name,
|
||||
norm_department_compare_id,
|
||||
norm_department_compare_name,
|
||||
prepare_beds_count,
|
||||
department_phone,
|
||||
department_mail,
|
||||
establish_date,
|
||||
revoke_date
|
||||
from department
|
||||
<where>
|
||||
<if test="departmentNames != null and departmentNames.size() > 0">
|
||||
and department_name in
|
||||
<foreach item="departmentName" collection="departmentNames" open="(" separator="," close=")">
|
||||
#{departmentName}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertDepartment" parameterType="Department" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into department
|
||||
@ -325,6 +358,59 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertDepartmentList">
|
||||
insert into department(
|
||||
parent_department_id,
|
||||
agency_id,
|
||||
agency_name,
|
||||
department_name,
|
||||
department_code,
|
||||
department_type,
|
||||
department_abbreviation,
|
||||
department_person_id,
|
||||
department_person_name,
|
||||
node_type,
|
||||
provide_service_category,
|
||||
subdivision_category_id,
|
||||
subdivision_category_name,
|
||||
norm_department_compare_id,
|
||||
norm_department_compare_name,
|
||||
prepare_beds_count,
|
||||
department_phone,
|
||||
department_mail,
|
||||
establish_date,
|
||||
revoke_date,
|
||||
create_by,
|
||||
create_time
|
||||
) values
|
||||
<foreach item="Department" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{Department.parentDepartmentId},
|
||||
#{Department.agencyId},
|
||||
#{Department.agencyName},
|
||||
#{Department.departmentName},
|
||||
#{Department.departmentCode},
|
||||
#{Department.departmentType},
|
||||
#{Department.departmentAbbreviation},
|
||||
#{Department.departmentPersonId},
|
||||
#{Department.departmentPersonName},
|
||||
#{Department.nodeType},
|
||||
#{Department.provideServiceCategory},
|
||||
#{Department.subdivisionCategoryId},
|
||||
#{Department.subdivisionCategoryName},
|
||||
#{Department.normDepartmentCompareId},
|
||||
#{Department.normDepartmentCompareName},
|
||||
#{Department.prepareBedsCount},
|
||||
#{Department.departmentPhone},
|
||||
#{Department.departmentMail},
|
||||
#{Department.establishDate},
|
||||
#{Department.revokeDate},
|
||||
#{Department.createBy},
|
||||
#{Department.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDepartment" parameterType="Department">
|
||||
update department
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
@ -0,0 +1,151 @@
|
||||
<?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.xinelu.manage.mapper.normdepartmentcompare.NormDepartmentCompareMapper">
|
||||
|
||||
<resultMap type="NormDepartmentCompare" id="NormDepartmentCompareResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="departmentId" column="department_id"/>
|
||||
<result property="departmentName" column="department_name"/>
|
||||
<result property="normCompareName" column="norm_compare_name"/>
|
||||
<result property="normCompareCode" column="norm_compare_code"/>
|
||||
<result property="normCompareSort" column="norm_compare_sort"/>
|
||||
<result property="normCompareRemark" column="norm_compare_remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNormDepartmentCompareVo">
|
||||
select id, department_id, department_name, norm_compare_name, norm_compare_code, norm_compare_sort, norm_compare_remark, create_by, create_time, update_by, update_time from norm_department_compare
|
||||
</sql>
|
||||
|
||||
<select id="selectNormDepartmentCompareList" parameterType="NormDepartmentCompare" resultMap="NormDepartmentCompareResult">
|
||||
<include refid="selectNormDepartmentCompareVo"/>
|
||||
<where>
|
||||
<if test="departmentId != null ">
|
||||
and department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
and department_name like concat('%', #{departmentName}, '%')
|
||||
</if>
|
||||
<if test="normCompareName != null and normCompareName != ''">
|
||||
and norm_compare_name like concat('%', #{normCompareName}, '%')
|
||||
</if>
|
||||
<if test="normCompareCode != null and normCompareCode != ''">
|
||||
and norm_compare_code = #{normCompareCode}
|
||||
</if>
|
||||
<if test="normCompareSort != null ">
|
||||
and norm_compare_sort = #{normCompareSort}
|
||||
</if>
|
||||
<if test="normCompareRemark != null and normCompareRemark != ''">
|
||||
and norm_compare_remark = #{normCompareRemark}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNormDepartmentCompareById" parameterType="Long"
|
||||
resultMap="NormDepartmentCompareResult">
|
||||
<include refid="selectNormDepartmentCompareVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertNormDepartmentCompare" parameterType="NormDepartmentCompare" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into norm_department_compare
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="departmentId != null">department_id,
|
||||
</if>
|
||||
<if test="departmentName != null">department_name,
|
||||
</if>
|
||||
<if test="normCompareName != null">norm_compare_name,
|
||||
</if>
|
||||
<if test="normCompareCode != null">norm_compare_code,
|
||||
</if>
|
||||
<if test="normCompareSort != null">norm_compare_sort,
|
||||
</if>
|
||||
<if test="normCompareRemark != null">norm_compare_remark,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="departmentId != null">#{departmentId},
|
||||
</if>
|
||||
<if test="departmentName != null">#{departmentName},
|
||||
</if>
|
||||
<if test="normCompareName != null">#{normCompareName},
|
||||
</if>
|
||||
<if test="normCompareCode != null">#{normCompareCode},
|
||||
</if>
|
||||
<if test="normCompareSort != null">#{normCompareSort},
|
||||
</if>
|
||||
<if test="normCompareRemark != null">#{normCompareRemark},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateNormDepartmentCompare" parameterType="NormDepartmentCompare">
|
||||
update norm_department_compare
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="departmentId != null">department_id =
|
||||
#{departmentId},
|
||||
</if>
|
||||
<if test="departmentName != null">department_name =
|
||||
#{departmentName},
|
||||
</if>
|
||||
<if test="normCompareName != null">norm_compare_name =
|
||||
#{normCompareName},
|
||||
</if>
|
||||
<if test="normCompareCode != null">norm_compare_code =
|
||||
#{normCompareCode},
|
||||
</if>
|
||||
<if test="normCompareSort != null">norm_compare_sort =
|
||||
#{normCompareSort},
|
||||
</if>
|
||||
<if test="normCompareRemark != null">norm_compare_remark =
|
||||
#{normCompareRemark},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNormDepartmentCompareById" parameterType="Long">
|
||||
delete from norm_department_compare where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNormDepartmentCompareByIds" parameterType="String">
|
||||
delete from norm_department_compare where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -67,29 +67,18 @@
|
||||
region.area_name region_name,
|
||||
region.area_code region_code,
|
||||
street.area_name street_name,
|
||||
street.area_code street_code
|
||||
street.area_code street_code,
|
||||
community.area_name community_name,
|
||||
community.area_code community_code
|
||||
FROM sys_area province,
|
||||
sys_area city,
|
||||
sys_area region,
|
||||
sys_area street
|
||||
sys_area street,
|
||||
sys_area community
|
||||
WHERE city.parent_code = province.area_code
|
||||
AND region.parent_code = city.area_code
|
||||
AND street.parent_code = region.area_code
|
||||
AND street.area_code = #{areaCode}
|
||||
UNION ALL
|
||||
SELECT province.area_name province_name,
|
||||
province.area_code province_code,
|
||||
city.area_name city_name,
|
||||
city.area_code city_code,
|
||||
region.area_name region_name,
|
||||
region.area_code region_code,
|
||||
'' street_name,
|
||||
'' street_code
|
||||
FROM sys_area province,
|
||||
sys_area city,
|
||||
sys_area region
|
||||
WHERE city.parent_code = province.area_code
|
||||
AND region.parent_code = city.area_code
|
||||
AND region.area_code = #{areaCode} limit 1;
|
||||
AND community.parent_code = street.area_code
|
||||
AND community.area_code = #{areaCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user