package com.imed.costaccount.web; import com.baomidou.mybatisplus.extension.api.R; import com.imed.costaccount.common.util.PageUtils; import com.imed.costaccount.common.util.Result; import com.imed.costaccount.service.HospProfitAndLossService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @Api(tags = "全院损益相关") @RestController @RequestMapping("/costAccount/hospProfitAndLoss") public class HospProfitAndLossController extends AbstractController { private final HospProfitAndLossService hospProfitAndLossService; public HospProfitAndLossController(HospProfitAndLossService hospProfitAndLossService) { this.hospProfitAndLossService = hospProfitAndLossService; } @ApiOperation("计算全院损益") @PostMapping("/calc") public Result calc(@RequestParam @ApiParam(name = "date", value = "yyyy-MM-dd") String date) { // hospProfitAndLossService.calc(date, getHospId()); hospProfitAndLossService.calcByResponsibility(date, getHospId()); return Result.ok(); } @ApiOperation("全院损益列表") @GetMapping("/getHospProfits") public Result getHospProfits(@RequestParam(value = "current", defaultValue = "1") Integer current, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(value = "date")String date) { PageUtils pageUtils = hospProfitAndLossService.getHospProfits(current, pageSize, date, getHospId()); return Result.ok(pageUtils); } @ApiOperation("全院损益计算输出") @PostMapping("/report") public Result hospProfitReport(@RequestParam String date, HttpServletResponse response) { try { hospProfitAndLossService.hospProfitReport(date,getHospId(),response); } catch (Exception e) { e.printStackTrace(); } return Result.ok(); } @ApiOperation("全院经营报表列表") @GetMapping("/hospReports") public Result hospReports(@RequestParam(value = "current", defaultValue = "1") Integer current, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(value = "date") String date) { PageUtils pageUtils = hospProfitAndLossService.hospProfitReports(current, pageSize, getHospId(),date); return Result.ok(pageUtils); } }