|
@@ -1,5 +1,6 @@
|
|
|
package com.imed.costaccount.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -9,11 +10,13 @@ import com.imed.costaccount.common.util.BeanUtil;
|
|
|
import com.imed.costaccount.common.util.PageUtils;
|
|
|
import com.imed.costaccount.mapper.DepartmentMapper;
|
|
|
import com.imed.costaccount.model.Department;
|
|
|
+import com.imed.costaccount.model.Hospital;
|
|
|
import com.imed.costaccount.model.User;
|
|
|
import com.imed.costaccount.model.dto.DepartmentRequest;
|
|
|
import com.imed.costaccount.model.vo.DepartmentVO;
|
|
|
import com.imed.costaccount.service.DepartmentService;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -28,7 +31,8 @@ import java.util.stream.Collectors;
|
|
|
@Service("departmentService")
|
|
|
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private HospitalServiceImpl hospitalService;
|
|
|
/**
|
|
|
* 分页查询科室信息
|
|
|
*
|
|
@@ -46,6 +50,14 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
.like(!StringUtils.isEmpty(name), Department::getDepartmentName, name));
|
|
|
List<Department> records = pages.getRecords();
|
|
|
List<DepartmentVO> departmentVOList = BeanUtil.convertList(records, DepartmentVO.class);
|
|
|
+ Hospital hospital = hospitalService.getOne(new QueryWrapper<Hospital>().lambda().eq(Hospital::getId, hospId));
|
|
|
+
|
|
|
+ departmentVOList.forEach(i->{
|
|
|
+ if (Objects.nonNull(hospital)){
|
|
|
+ i.setHospName(hospital.getName());
|
|
|
+ }
|
|
|
+ i.setCreateDateTime(DateUtil.format(DateUtil.date(i.getCreateTime()),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ });
|
|
|
PageUtils pageUtils = new PageUtils(pages);
|
|
|
pageUtils.setList(departmentVOList);
|
|
|
return pageUtils;
|