pclogin + hosptial

master
zhuqing 2 years ago
parent e16698a4ed
commit 58baace802

@ -2,7 +2,9 @@ package com.ruoyi.web.controller.pc;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -27,6 +29,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi * @author ruoyi
* @date 2022-08-03 * @date 2022-08-03
*/ */
@Api("pc-医院列表")
@RestController @RestController
@RequestMapping("/system/hospital") @RequestMapping("/system/hospital")
public class THospitalController extends BaseController public class THospitalController extends BaseController
@ -37,6 +40,7 @@ public class THospitalController extends BaseController
/** /**
* *
*/ */
@ApiOperation("查询医院信息列表")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(THospital tHospital) public TableDataInfo list(THospital tHospital)
{ {
@ -60,6 +64,7 @@ public class THospitalController extends BaseController
/** /**
* *
*/ */
@ApiOperation("获取医院信息详细信息")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
@ -69,6 +74,7 @@ public class THospitalController extends BaseController
/** /**
* *
*/ */
@ApiOperation("新增医院信息")
@Log(title = "医院信息", businessType = BusinessType.INSERT) @Log(title = "医院信息", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody THospital tHospital) public AjaxResult add(@RequestBody THospital tHospital)
@ -79,6 +85,7 @@ public class THospitalController extends BaseController
/** /**
* *
*/ */
@ApiOperation("修改医院信息")
@Log(title = "医院信息", businessType = BusinessType.UPDATE) @Log(title = "医院信息", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody THospital tHospital) public AjaxResult edit(@RequestBody THospital tHospital)
@ -89,6 +96,7 @@ public class THospitalController extends BaseController
/** /**
* *
*/ */
@ApiOperation("删除医院信息")
@Log(title = "医院信息", businessType = BusinessType.DELETE) @Log(title = "医院信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids)

@ -2,7 +2,12 @@ package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Set; 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.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -34,6 +39,12 @@ public class SysLoginController
@Autowired @Autowired
private SysPermissionService permissionService; private SysPermissionService permissionService;
@Autowired
private ITHospitalService itHospitalService;
@Autowired
private ITDoctorService itDoctorService;
/** /**
* *
* *
@ -76,6 +87,19 @@ public class SysLoginController
ajax.put("user", user); ajax.put("user", user);
ajax.put("roles", roles); ajax.put("roles", roles);
ajax.put("permissions", permissions); ajax.put("permissions", permissions);
//添加医生和医院标识返回
THospital tHospital = new THospital();
tHospital.setAdminId(user.getUserId());
List<THospital> tHospitals = itHospitalService.selectTHospitalList(tHospital);
if (!ObjectUtils.isEmpty(tHospitals)){
ajax.put("hospitalId", tHospitals.get(0).getId());
}
TDoctor tDoctor = new TDoctor();
tDoctor.setUserId(user.getUserId());
List<TDoctor> selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor);
if (!ObjectUtils.isEmpty(selectTDoctorList)){
ajax.put("doctorId", selectTDoctorList.get(0).getId());
}
return ajax; return ajax;
} }

@ -1,32 +1,41 @@
package com.ruoyi.system.domain; 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.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.NotNull;
/** /**
* t_hospital * t_hospital
* *
* @author ruoyi * @author ruoyi
* @date 2022-08-04 * @date 2022-08-04
*/ */
@ApiModel(value = "THospital", description = "PC端医院实体")
public class THospital extends BaseEntity public class THospital extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** ID */ /** ID */
@ApiModelProperty("id")
private Long id; private Long id;
/** 名称 */ /** 名称 */
@ApiModelProperty("名称")
@Excel(name = "名称") @Excel(name = "名称")
private String name; private String name;
/** 排序 */ /** 排序 */
@ApiModelProperty("排序")
@Excel(name = "排序") @Excel(name = "排序")
private Long num; private Long num;
/** 管理员ID */ /** 管理员ID */
@ApiModelProperty("管理员ID")
@Excel(name = "管理员ID") @Excel(name = "管理员ID")
private Long adminId; private Long adminId;

Loading…
Cancel
Save