package com.ruoyi.web.controller.smartor;
|
|
import cn.hutool.db.Page;
|
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.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.MedicalHistory;
|
import com.smartor.service.IMedicalHistoryService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* 病史Controller
|
*
|
* @author ruoyi
|
* @date 2023-12-06
|
*/
|
@Api(description = "病史")
|
@RestController
|
@RequestMapping("/medicalhistory")
|
public class MedicalHistoryController extends BaseController {
|
@Autowired
|
private IMedicalHistoryService medicalHistoryService;
|
|
/**
|
* 查询病史列表
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:list')")
|
@PostMapping("/selectMedicalHistoryList")
|
@ApiOperation("查询病史列表")
|
public TableDataInfo selectMedicalHistorylist(@RequestBody MedicalHistory medicalHistory) {
|
PageUtils.startPageByPost(medicalHistory.getPageNum(),medicalHistory.getPageSize());
|
List<MedicalHistory> list = medicalHistoryService.selectMedicalHistoryList(medicalHistory);
|
return getDataTable(list);
|
}
|
|
/**
|
* 导出病史列表
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:export')")
|
@Log(title = "病史", businessType = BusinessType.EXPORT)
|
@ApiOperation("导出病史列表")
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, MedicalHistory medicalHistory) {
|
List<MedicalHistory> list = medicalHistoryService.selectMedicalHistoryList(medicalHistory);
|
ExcelUtil<MedicalHistory> util = new ExcelUtil<MedicalHistory>(MedicalHistory.class);
|
util.exportExcel(response, list, "病史数据");
|
}
|
|
/**
|
* 获取病史详细信息
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:query')")
|
@ApiOperation("获取病史详细信息")
|
@GetMapping(value = "/getInfo/{id}")
|
public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("pid") Long pid) {
|
return success(medicalHistoryService.selectMedicalHistoryById(id));
|
}
|
|
/**
|
* 新增病史
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:add')")
|
@Log(title = "病史", businessType = BusinessType.INSERT)
|
@ApiOperation("新增病史")
|
@PostMapping("/add")
|
public AjaxResult add(@RequestBody MedicalHistory medicalHistory) {
|
medicalHistory.setOrgid(getOrgid());
|
return toAjax(medicalHistoryService.insertMedicalHistory(medicalHistory));
|
}
|
|
/**
|
* 修改病史
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:edit')")
|
@Log(title = "病史", businessType = BusinessType.UPDATE)
|
@ApiOperation("修改病史")
|
@PostMapping("/edit")
|
public AjaxResult edit(@RequestBody MedicalHistory medicalHistory) {
|
return toAjax(medicalHistoryService.updateMedicalHistory(medicalHistory));
|
}
|
|
/**
|
* 删除病史
|
*/
|
//@PreAuthorize("@ss.hasPermi('system:history:remove')")
|
@Log(title = "病史", businessType = BusinessType.DELETE)
|
@ApiOperation("删除病史")
|
@GetMapping("/remove/{ids}")
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
return toAjax(medicalHistoryService.deleteMedicalHistoryByIds(ids));
|
}
|
}
|