liusheng
2024-11-22 5389773b2d1ae86daec68b00f67c3682dc907e01
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatMedInhospController.java
@@ -1,40 +1,36 @@
package com.smartor.controller;
package com.ruoyi.web.controller.smartor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.ISelect;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.smartor.domain.PatMedInhosp;
import com.smartor.service.IPatMedInhospService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.PatMedInhosp;
import com.smartor.domain.PatMedInhospVO;
import com.smartor.domain.PatMedReq;
import com.smartor.service.IPatMedInhospService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 患者住院记录Controller
 *
 *
 * @author smartor
 * @date 2023-03-04
 */
@Api(description = "患者住院记录")
@RestController
@RequestMapping("/smartor/patinhosp")
public class PatMedInhospController extends BaseController
{
public class PatMedInhospController extends BaseController {
    @Autowired
    private IPatMedInhospService patMedInhospService;
@@ -42,24 +38,62 @@
     * 查询患者住院记录列表
     */
    @ApiOperation("查询患者住院记录列表")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')")
    @GetMapping("/list")
    public TableDataInfo list(PatMedInhosp patMedInhosp)
    {
        startPage();
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')")
    @PostMapping("/selectPatMedInhospList")
    public TableDataInfo selectPatMedInhosplist(@RequestBody PatMedInhosp patMedInhosp) {
        PageUtils.startPageByPost(patMedInhosp.getPageNum(), patMedInhosp.getPageSize());
        List<PatMedInhosp> list = patMedInhospService.selectPatMedInhospList(patMedInhosp);
        return getDataTable(list);
        long count = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                patMedInhospService.selectPatMedInhospList(patMedInhosp);
            }
        });
        return getDataTable2(count, list);
    }
    /**
     * 查询当前登陆人自己(病区、部门)的患者住院记录列表
     */
    @ApiOperation("查询当前登陆人自己(病区、部门)的患者住院记录列表")
    @PostMapping("/selectPatMedInhospListByCondition")
    public TableDataInfo selectPatMedInhospListByCondition(@RequestBody PatMedInhospVO patMedInhospVO) {
        PageUtils.startPageByPost(patMedInhospVO.getPageNum(), patMedInhospVO.getPageSize());
        List<PatMedInhosp> list = null;
        if (!CollectionUtils.isEmpty(patMedInhospVO.getLeavehospitaldistrictcodes())) {
            list = patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
        } else if (!CollectionUtils.isEmpty(patMedInhospVO.getLeaveldeptcodes())) {
            list = patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
        }
        long count = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
            }
        });
        return getDataTable2(count, list);
    }
    @PostMapping("/getDeptCodeByPatId")
    @ApiOperation("查询住、出院部门编码通过patId")
    public AjaxResult getDeptCodeByPatId(@RequestBody PatMedInhosp patMedInhosp) {
        return success(patMedInhospService.getDeptCodeByPatId(patMedInhosp));
    }
    @PostMapping("/selectPatMedInhospListCount")
    @ApiOperation("查询出、入院看病人次和人数")
    public AjaxResult selectPatMedInhospListCount(PatMedReq patMedReq) {
        return success(patMedInhospService.selectPatMedInhospListCount(patMedReq));
    }
    /**
     * 导出患者住院记录列表
     */
    @ApiOperation("导出患者住院记录列表")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:export')")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:export')")
    @Log(title = "患者住院记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PatMedInhosp patMedInhosp)
    {
    public void export(HttpServletResponse response, PatMedInhosp patMedInhosp) {
        List<PatMedInhosp> list = patMedInhospService.selectPatMedInhospList(patMedInhosp);
        ExcelUtil<PatMedInhosp> util = new ExcelUtil<PatMedInhosp>(PatMedInhosp.class);
        util.exportExcel(response, list, "患者住院记录数据");
@@ -69,10 +103,9 @@
     * 获取患者住院记录详细信息
     */
    @ApiOperation("获取患者住院记录详细信息")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:query')")
    @GetMapping(value = "/{inhospid}")
    public AjaxResult getInfo(@PathVariable("inhospid") Long inhospid)
    {
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:query')")
    @GetMapping(value = "/getInfo/{inhospid}")
    public AjaxResult getInfo(@PathVariable("inhospid") Long inhospid) {
        return success(patMedInhospService.selectPatMedInhospByInhospid(inhospid));
    }
@@ -80,11 +113,10 @@
     * 新增患者住院记录
     */
    @ApiOperation("新增患者住院记录")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:add')")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:add')")
    @Log(title = "患者住院记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PatMedInhosp patMedInhosp)
    {
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PatMedInhosp patMedInhosp) {
        return toAjax(patMedInhospService.insertPatMedInhosp(patMedInhosp));
    }
@@ -92,11 +124,10 @@
     * 修改患者住院记录
     */
    @ApiOperation("修改患者住院记录")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:edit')")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:edit')")
    @Log(title = "患者住院记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PatMedInhosp patMedInhosp)
    {
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody PatMedInhosp patMedInhosp) {
        return toAjax(patMedInhospService.updatePatMedInhosp(patMedInhosp));
    }
@@ -104,11 +135,34 @@
     * 删除患者住院记录
     */
    @ApiOperation("删除患者住院记录")
    @PreAuthorize("@ss.hasPermi('smartor:patinhosp:remove')")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:remove')")
    @Log(title = "患者住院记录", businessType = BusinessType.DELETE)
   @DeleteMapping("/{inhospids}")
    public AjaxResult remove(@PathVariable Long[] inhospids)
    {
    @GetMapping("/remove/{inhospids}")
    public AjaxResult remove(@PathVariable Long[] inhospids) {
        return toAjax(patMedInhospService.deletePatMedInhospByInhospids(inhospids));
    }
    /**
     * 各科室服务人次
     *
     * @return
     */
    @ApiOperation("各科室服务人次")
    @PostMapping("/getDeptRanking")
    public TableDataInfo getDeptRanking(@RequestBody PatMedReq patMedReq) {
        return getDataTable(patMedInhospService.getDeptRanking(patMedReq));
    }
    /**
     * 医护与患者关联关系
     *
     * @return
     */
    @ApiOperation("医护与患者关联关系")
    @PostMapping("/getDocAndPat")
    public TableDataInfo getDocAndPat(@RequestBody PatMedInhosp patMedInhosp) {
        return getDataTable(patMedInhospService.getDocAndPat(patMedInhosp));
    }
}