From 58baace802be1b5d13e50a3a45ad66b97c8e42fd Mon Sep 17 00:00:00 2001 From: zhuqing Date: Tue, 9 Aug 2022 09:53:50 +0800 Subject: [PATCH] pclogin + hosptial --- .../controller/pc/THospitalController.java | 10 +++++++- .../controller/system/SysLoginController.java | 24 +++++++++++++++++++ .../com/ruoyi/system/domain/THospital.java | 9 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/THospitalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/THospitalController.java index 5410b2c..4bffa50 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/THospitalController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/THospitalController.java @@ -2,7 +2,9 @@ package com.ruoyi.web.controller.pc; import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.springframework.security.access.prepost.PreAuthorize; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -27,6 +29,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @author ruoyi * @date 2022-08-03 */ +@Api("pc-医院列表") @RestController @RequestMapping("/system/hospital") public class THospitalController extends BaseController @@ -37,6 +40,7 @@ public class THospitalController extends BaseController /** * 查询医院信息列表 */ + @ApiOperation("查询医院信息列表") @GetMapping("/list") public TableDataInfo list(THospital tHospital) { @@ -60,6 +64,7 @@ public class THospitalController extends BaseController /** * 获取医院信息详细信息 */ + @ApiOperation("获取医院信息详细信息") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -69,6 +74,7 @@ public class THospitalController extends BaseController /** * 新增医院信息 */ + @ApiOperation("新增医院信息") @Log(title = "医院信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody THospital tHospital) @@ -79,6 +85,7 @@ public class THospitalController extends BaseController /** * 修改医院信息 */ + @ApiOperation("修改医院信息") @Log(title = "医院信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody THospital tHospital) @@ -89,6 +96,7 @@ public class THospitalController extends BaseController /** * 删除医院信息 */ + @ApiOperation("删除医院信息") @Log(title = "医院信息", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 3aa2ee9..5fc940f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -2,7 +2,12 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.Set; +import com.ruoyi.system.domain.TDoctor; +import com.ruoyi.system.domain.THospital; +import com.ruoyi.system.service.ITDoctorService; +import com.ruoyi.system.service.ITHospitalService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -34,6 +39,12 @@ public class SysLoginController @Autowired private SysPermissionService permissionService; + @Autowired + private ITHospitalService itHospitalService; + + @Autowired + private ITDoctorService itDoctorService; + /** * 登录方法 * @@ -76,6 +87,19 @@ public class SysLoginController ajax.put("user", user); ajax.put("roles", roles); ajax.put("permissions", permissions); + //添加医生和医院标识返回 + THospital tHospital = new THospital(); + tHospital.setAdminId(user.getUserId()); + List tHospitals = itHospitalService.selectTHospitalList(tHospital); + if (!ObjectUtils.isEmpty(tHospitals)){ + ajax.put("hospitalId", tHospitals.get(0).getId()); + } + TDoctor tDoctor = new TDoctor(); + tDoctor.setUserId(user.getUserId()); + List selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor); + if (!ObjectUtils.isEmpty(selectTDoctorList)){ + ajax.put("doctorId", selectTDoctorList.get(0).getId()); + } return ajax; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/THospital.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/THospital.java index 1cb1aaa..13ea616 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/THospital.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/THospital.java @@ -1,32 +1,41 @@ package com.ruoyi.system.domain; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import javax.validation.constraints.NotNull; + /** * 医院信息对象 t_hospital * * @author ruoyi * @date 2022-08-04 */ +@ApiModel(value = "THospital", description = "PC端医院实体") public class THospital extends BaseEntity { private static final long serialVersionUID = 1L; /** ID */ + @ApiModelProperty("id") private Long id; /** 名称 */ + @ApiModelProperty("名称") @Excel(name = "名称") private String name; /** 排序 */ + @ApiModelProperty("排序") @Excel(name = "排序") private Long num; /** 管理员ID */ + @ApiModelProperty("管理员ID") @Excel(name = "管理员ID") private Long adminId;