package com.ruoyi.web.controller.smartor; 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.core.domain.entity.SysUser; 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 com.smartor.service.IPatMedOuthospService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; 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 { @Autowired private IPatMedInhospService patMedInhospService; @Autowired private IPatMedOuthospService iPatMedOuthospService; @Value("${visitHosp}") private Integer visitHosp; /** * 查询患者住院记录列表 */ @ApiOperation("查询患者住院记录列表") //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')") @PostMapping("/selectPatMedInhospList") public TableDataInfo selectPatMedInhosplist(@RequestBody PatMedInhosp patMedInhosp) { PageUtils.startPageByPost(patMedInhosp.getPageNum(), patMedInhosp.getPageSize()); List list = patMedInhospService.selectPatMedInhospList(patMedInhosp); 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 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')") @Log(title = "患者住院记录", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, PatMedInhosp patMedInhosp) { List list = patMedInhospService.selectPatMedInhospList(patMedInhosp); ExcelUtil util = new ExcelUtil(PatMedInhosp.class); util.exportExcel(response, list, "患者住院记录数据"); } /** * 获取患者住院记录详细信息 */ @ApiOperation("获取患者住院记录详细信息") //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:query')") @GetMapping(value = "/getInfo/{inhospid}") public AjaxResult getInfo(@PathVariable("inhospid") Long inhospid) { return success(patMedInhospService.selectPatMedInhospByInhospid(inhospid)); } /** * 新增患者住院记录 */ @ApiOperation("新增患者住院记录") //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:add')") @Log(title = "患者住院记录", businessType = BusinessType.INSERT) @PostMapping("/add") public AjaxResult add(@RequestBody PatMedInhosp patMedInhosp) { SysUser user = getLoginUser().getUser(); patMedInhosp.setOrgid(user.getOrgid()); return toAjax(patMedInhospService.insertPatMedInhosp(patMedInhosp)); } /** * 修改患者住院记录 */ @ApiOperation("修改患者住院记录") //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:edit')") @Log(title = "患者住院记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") public AjaxResult edit(@RequestBody PatMedInhosp patMedInhosp) { return toAjax(patMedInhospService.updatePatMedInhosp(patMedInhosp)); } /** * 删除患者住院记录 */ @ApiOperation("删除患者住院记录") //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:remove')") @Log(title = "患者住院记录", businessType = BusinessType.DELETE) @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)); } // /** // * 医护与患者关联关系 // * // * @return // */ // @ApiOperation("医护与患者关联关系") // @GetMapping("/test") // public void test() { // patMedInhospService.dealOutHospInfo(); // // //门诊表 // if (visitHosp != 1) { // iPatMedOuthospService.dealOutpatientInfo(); // } // } }