|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.api.controller.info;
|
|
package com.ruoyi.api.controller.info;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -8,16 +10,24 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import com.ruoyi.api.controller.common.AbstractApiController;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.validate.QueryGroup;
|
|
import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
|
|
+import com.ruoyi.common.utils.BeanCopyUtils;
|
|
|
import com.ruoyi.info.hospital.domain.bo.HospitalDepartmentBo;
|
|
import com.ruoyi.info.hospital.domain.bo.HospitalDepartmentBo;
|
|
|
|
|
+import com.ruoyi.info.hospital.domain.vo.DepartmentSimpleInfoVo;
|
|
|
import com.ruoyi.info.hospital.domain.vo.HospitalDepartmentVo;
|
|
import com.ruoyi.info.hospital.domain.vo.HospitalDepartmentVo;
|
|
|
|
|
+import com.ruoyi.info.hospital.domain.vo.HospitalSimpleInfoVo;
|
|
|
import com.ruoyi.info.hospital.service.IHospitalDepartmentService;
|
|
import com.ruoyi.info.hospital.service.IHospitalDepartmentService;
|
|
|
|
|
+import com.ruoyi.info.management.domain.TeacherDepartmentRel;
|
|
|
|
|
+import com.ruoyi.info.management.service.ITeacherDepartmentRelService;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
|
|
+import static com.ruoyi.common.utils.CollectionUtils.convertSet;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @author fucheng.bai
|
|
* @author fucheng.bai
|
|
|
* @date 2025/9/22
|
|
* @date 2025/9/22
|
|
@@ -27,10 +37,12 @@ import lombok.RequiredArgsConstructor;
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/api/info/hospitalDepartment")
|
|
@RequestMapping("/api/info/hospitalDepartment")
|
|
|
-public class ApiHospitalDepartmentController {
|
|
|
|
|
|
|
+public class ApiHospitalDepartmentController extends AbstractApiController {
|
|
|
|
|
|
|
|
private final IHospitalDepartmentService iHospitalDepartmentService;
|
|
private final IHospitalDepartmentService iHospitalDepartmentService;
|
|
|
|
|
|
|
|
|
|
+ private final ITeacherDepartmentRelService iTeacherDepartmentRelService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取科室列表
|
|
* 获取科室列表
|
|
|
*/
|
|
*/
|
|
@@ -41,5 +53,20 @@ public class ApiHospitalDepartmentController {
|
|
|
return R.ok(iHospitalDepartmentService.queryByHospitalId(bo));
|
|
return R.ok(iHospitalDepartmentService.queryByHospitalId(bo));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation("获取管理老师关联的科室列表")
|
|
|
|
|
+ @GetMapping("/teacher/simpleList")
|
|
|
|
|
+ public R<List<DepartmentSimpleInfoVo>> getTeacherSimpleInfo(@RequestParam(value = "hospitalId", required = false) Long hospitalId) {
|
|
|
|
|
+ Long teacherId = getTeacherId();
|
|
|
|
|
+
|
|
|
|
|
+ List<TeacherDepartmentRel> teacherDepartmentRelList = iTeacherDepartmentRelService.queryByTeacherId(teacherId);
|
|
|
|
|
+ Set<Long> departmentIds = teacherDepartmentRelList.stream()
|
|
|
|
|
+ .filter(item -> hospitalId == null || item.getHospitalId().equals(hospitalId))
|
|
|
|
|
+ .map(TeacherDepartmentRel::getDepartmentId).collect(Collectors.toSet());
|
|
|
|
|
+
|
|
|
|
|
+ List<HospitalDepartmentVo> departmentList = iHospitalDepartmentService.queryListByIds(departmentIds);
|
|
|
|
|
+ List<DepartmentSimpleInfoVo> simpleDepartmentList = BeanCopyUtils.copyList(departmentList, DepartmentSimpleInfoVo.class);
|
|
|
|
|
+ return R.ok(simpleDepartmentList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|