package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.request.SettledApplyInquiry;
import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response.SiSettleApply;
import thyyxxk.webserver.entity.inpatient.patient.Patient;
import thyyxxk.webserver.service.medicalinsurance.SiSettleApplyService;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/siSettleApply")
public class SiSettleApplyController {
    private final SiSettleApplyService service;

    @Autowired
    public SiSettleApplyController(SiSettleApplyService service) {
        this.service = service;
    }

    @PostMapping("/selectSettleApply")
    public ResultVo<SiSettleApply> selectSettleApply(@RequestBody Patient p) {
        return service.selectSettleApply(p);
    }

    @PostMapping("/submitSettleApply")
    public ResultVo<String> submitSettleApply(@RequestBody SiSettleApply apply) {
        return service.submitSettleApply(apply);
    }

    @GetMapping("/selectUnhandledApplies")
    public ResultVo<List<SiSettleApply>> selectUnhandledApplies() {
        return service.selectUnhandledApplies();
    }

    @PostMapping("/selectPatientInfo")
    public ResultVo<Map<String, Object>> selectPatientInfo(@RequestBody SiSettleApply apply) {
        return service.selectPatientInfo(apply);
    }

    @PostMapping("/handleApply")
    public ResultVo<String> handleApply(@RequestBody SiSettleApply apply) {
        return service.handleApply(apply);
    }

    @PostMapping("/selectApplyHistories")
    public ResultVo<List<SiSettleApply>> selectApplyHistories(@RequestBody SiSettleApply apply) {
        return service.selectApplyHistories(apply);
    }

    @PostMapping("/selectSettledApplies")
    public ResultVo<List<SiSettleApply>> selectSettledApplies(@RequestBody @Validated SettledApplyInquiry inquiry) {
        return service.selectSettledApplies(inquiry);
    }
}
