package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicalinsurance.hospitalapproval.PatientFeeItem;
import thyyxxk.webserver.service.medicalinsurance.HospitalApprovalService;

import java.util.List;

@RestController
@RequestMapping("/hospitalApproval")
public class HospitalApprovalController {
    private final HospitalApprovalService service;

    @Autowired
    public HospitalApprovalController(HospitalApprovalService service) {
        this.service = service;
    }

    @GetMapping("/getPatientFeeList")
    public ResultVo<List<PatientFeeItem>> getPatientFeeList(@RequestParam("patNo") String patNo,
                                                            @RequestParam("times") Integer times,
                                                            @RequestParam("ledgerSn") Integer ledgerSn) {
        return service.getPatientFeeList(patNo, times, ledgerSn);
    }

    @GetMapping("/getAppliedItems")
    public ResultVo<List<PatientFeeItem>> getAppliedItems(@RequestParam("patNo") String patNo,
                                                          @RequestParam("times") Integer times,
                                                          @RequestParam("ledgerSn") Integer ledgerSn) {
        return service.getAppliedItems(patNo, times, ledgerSn);
    }

    @PostMapping("/applyHospitalApproval")
    public ResultVo<String> applyHospitalApproval(@RequestBody PatientFeeItem feeItem) {
        return service.applyHospitalApproval(feeItem);
    }

    @GetMapping("/getAllApplies")
    public ResultVo<List<PatientFeeItem>> getAllApplies(@RequestParam("month") String month) {
        return service.getAllApplies(month);
    }

    @PostMapping("/confirmHandleApply")
    public ResultVo<String> confirmHandleApply(@RequestBody PatientFeeItem feeItem) {
        return service.confirmHandleApply(feeItem);
    }
}
