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.markmtfees.MzDepositFile;
import thyyxxk.webserver.entity.markmtfees.MzReceipt;
import thyyxxk.webserver.entity.markmtfees.OrderNo;
import thyyxxk.webserver.entity.medicalinsurance.outpatient.SiMzDiag;
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.FundDetail;
import thyyxxk.webserver.entity.medicalinsurance.outpatient.MzPatientInfo;
import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
import thyyxxk.webserver.entity.medicalinsurance.outpatient.SpcChrDiseAcct;
import thyyxxk.webserver.service.medicalinsurance.SiMzService;

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

/**
 * @description: 门诊医保入口
 * @author: DingJie
 * @create: 2021/7/2214:24
 */
@RestController
@RequestMapping("/siMz")
public class SiMzController {
    private final SiMzService service;

    @Autowired
    public SiMzController(SiMzService service) {
        this.service = service;
    }

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

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

    @PassToken
    @PostMapping("/getMzReceipts")
    public ResultVo<List<Map<String, Object>>> getMzReceipts(@RequestBody MzPatientInfo p) {
        return service.getMzReceipts(p);
    }

    @GetMapping("/getHistoryMzReceipts")
    public ResultVo<List<MzDepositFile>> getHistoryMzReceipts(@RequestParam("patNo") String patNo,
                                                              @RequestParam("start") String start,
                                                              @RequestParam("end") String end) {
        return service.getHistoryMzReceipts(patNo, start, end);
    }

    @PostMapping("/getHistoryReceiptDetail")
    public ResultVo<Map<String, Object>> getHistoryReceiptDetail(@RequestBody MzDepositFile depositFile) {
        return service.getHistoryReceiptDetail(depositFile);
    }

    @PassToken
    @PostMapping("/insertSiMzFees")
    public ResultVo<String> insertSiMzFees(@RequestBody List<MzReceipt> receipts) {
        return service.insertSiMzFees(receipts);
    }

    @PostMapping("/deleteMzReceipt")
    public ResultVo<String> deleteMtFees(@RequestBody OrderNo param) {
        return service.deleteMzReceipt(param);
    }

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

    @PostMapping("/uploadOutpatientFeeDetails")
    public ResultVo<SiPatInfo> uploadOutpatientFeeDetails(@RequestBody SpcChrDiseAcct p) {
        return service.uploadOutpatientFeeDetails(p);
    }

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

    @PostMapping("/outpatientPreSettlement")
    public ResultVo<FundDetail> outpatientPreSettlement(@RequestBody MzPatientInfo p) {
        return service.outpatientPreSettlement(p);
    }

    @PostMapping("/outpatientSettlement")
    public ResultVo<FundDetail> outpatientSettlement(@RequestBody MzPatientInfo p) {
        return service.outpatientSettlement(p);
    }

    @PostMapping("/revokeOutpatientSettlement")
    public ResultVo<FundDetail> revokeOutpatientSettlement(@RequestBody MzPatientInfo p) {
        return service.revokeOutpatientSettlement(p);
    }

    @PostMapping("/saveSiMzDiags")
    public ResultVo<String> saveSiMzDiags(@RequestBody List<SiMzDiag> diags) {
        return service.saveSiMzDiags(diags);
    }
}
