package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.inpatient.patient.NotUploadedFee;
import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;
import thyyxxk.webserver.entity.inpatient.patient.Overview;
import thyyxxk.webserver.service.medicalinsurance.SiZyService;
import thyyxxk.webserver.service.medicalinsurance.impl.ZyYbData;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;

/**
 * @description: 住院医保入口
 * @author: DingJie
 * @create: 2021-06-08 16:18:53
 **/
@RestController
@RequestMapping("/siZy")
public class SiZyController {
    private final SiZyService service;
    private final ZyYbData zyYbData;

    @Autowired
    public SiZyController(SiZyService service, ZyYbData zyYbData) {
        this.service = service;
        this.zyYbData = zyYbData;
    }

    @PostMapping("/admissRegister")
    public ResultVo<String> admissRegister(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.admissRegister(p, zyYbData));
    }

    @PostMapping("/modifyAdmissionInfo")
    public ResultVo<String> modifyAdmissionInfo(@RequestBody ZyPatientInfo p) {
        return service.modifyAdmissionInfo(p);
    }

    @PassToken
    @PostMapping("/revokeAdmission")
    public ResultVo<String> revokeAdmission(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.revokeAdmission(p));
    }

    @PostMapping("/uploadFeeDetail")
    public ResultVo<String> uploadFeeDetail(@RequestBody Overview o) {
        return service.uploadFeeDetail(o);
    }

    @PostMapping("/multipleUpload")
    public ResultVo<String> multipleUpload(@RequestBody List<Overview> overviews) {
        return service.multipleUpload(overviews);
    }

    @PostMapping("/injuryMultipleUpload")
    public ResultVo<String> injuryMultipleUpload(@RequestBody List<Overview> overviews) {
        return service.injuryMultipleUpload(overviews);
    }

    @PostMapping("/pairNegativeFee")
    public ResultVo<String> pairNegativeFee(@RequestBody NotUploadedFee fee) {
        return service.pairNegativeFee(fee);
    }

    @PostMapping("/revokeUploadFees")
    public ResultVo<String> revokeUploadFees(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.revokeUploadFees(p));
    }

    @PostMapping("/revokeWorkInjuryUploadFees")
    public ResultVo<String> revokeWorkInjuryUploadFees(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.revokeWorkInjuryUploadFees(p));
    }

    @PostMapping("/hospitalizationPreSettlement")
    public ResultVo<String> hospitalizationPreSettlement(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.hospitalizationPreSettlement(p, zyYbData));
    }

    @PostMapping("/dischargeProcessing")
    public ResultVo<String> dischargeProcessing(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.dischargeProcessing(p, zyYbData));
    }

    @PassToken
    @PostMapping("/revokeDischarge")
    public ResultVo<String> revokeDischarge(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.revokeDischarge(p));
    }

    @PassToken
    @PostMapping("/revokeSettlement")
    public ResultVo<String> revokeSettlement(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.revokeSettlement(p));
    }

    @PostMapping("/timeoutSettlement")
    public ResultVo<String> timeoutSettlement(@RequestBody ZyPatientInfo p) {
        return ResultVoUtil.success(service.timeoutSettlement(p));
    }

    @PassToken
    @GetMapping("/revokeSingleCharge")
    public ResultVo<String> revokeSingleCharge(@RequestParam("patNo") String patNo,
                                               @RequestParam("times") Integer times,
                                               @RequestParam("ledgerSn") Integer ledgerSn,
                                               @RequestParam("detailSn") Integer detailSn) {
        return service.revokeSingleCharge(patNo, times, ledgerSn, detailSn);
    }
}
