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.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicalinsurance.psnrcd.*;
import thyyxxk.webserver.entity.medicalinsurance.query.BscQryPrm;
import thyyxxk.webserver.service.medicalinsurance.SiPsnRcdService;

import java.util.List;

/**
 * @description: 人员备案入口
 * @author: DingJie
 * @create: 2021/7/1615:20
 */
@RestController
@RequestMapping("/siPsnRcd")
public class SiPsnRcdController {
    private final SiPsnRcdService service;

    @Autowired
    public SiPsnRcdController(SiPsnRcdService service) {
        this.service = service;
    }

    @PostMapping("/specialChronicDiseasesRecord")
    public ResultVo<String> specialChronicDiseasesRecord(@Validated @RequestBody SlwSpcDiseRcd slwSpcDiseRcd) {
        return service.specialChronicDiseasesRecord(slwSpcDiseRcd);
    }

    @GetMapping("/getAllSpcChrRcdsByPsnNo")
    public ResultVo<List<SlwSpcDiseRcd>> getAllSpcChrRcdsByPsnNo(@RequestParam("psnNo") String psnNo) {
        return service.getAllSpcChrRcdsByPsnNo(psnNo);
    }

    @PostMapping("/revokeSpecialChronicDiseasesRecord")
    public ResultVo<String> revokeSpecialChronicDiseasesRecord(@RequestBody RvkPsnRcd rvkPsnRcd) {
        return service.revokeSpecialChronicDiseasesRecord(rvkPsnRcd);
    }

    @PostMapping("/transferHospitalRecord")
    public ResultVo<String> transferHospitalRecord(@Validated @RequestBody TransHospRcd trsHspRcd) {
        return service.transferHospitalRecord(trsHspRcd);
    }

    @GetMapping("/getAllTrsHospRcdByPsnNo")
    public ResultVo<List<TransHospRcd>> getAllTrsHospRcdByPsnNo(@RequestParam("psnNo") String psnNo) {
        return service.getAllTrsHospRcdByPsnNo(psnNo);
    }

    @PostMapping("/revokeTransferHospitalRecord")
    public ResultVo<String> revokeTransferHospitalRecord(@RequestBody RvkPsnRcd rvkPsnRcd) {
        return service.revokeTransferHospitalRecord(rvkPsnRcd);
    }

    @PassToken
    @PostMapping("/personnelAssignmentRecord")
    public ResultVo<String> personnelAssignmentRecord(@Validated @RequestBody PsnAsgnmtRcd psnAgnRcd) {
        return service.personnelAssignmentRecord(psnAgnRcd);
    }

    @GetMapping("/getAllPsnAsgnmtRcdByPsnNo")
    public ResultVo<List<PsnAsgnmtRcd>> getAllPsnAsgnmtRcdByPsnNo(@RequestParam("psnNo") String psnNo) {
        return service.getAllPsnAsgnmtRcdByPsnNo(psnNo);
    }

    @PassToken
    @PostMapping("/revokePersonnelAssignmentRecord")
    public ResultVo<String> revokePersonnelAssignmentRecord(@RequestBody RvkPsnRcd rvkPsnRcd) {
        return service.revokePersonnelAssignmentRecord(rvkPsnRcd);
    }

    @PassToken
    @PostMapping("/personnelAccidentRecord")
    public ResultVo<String> personnelAccidentRecord(@RequestBody PsnAccdntRcd psnAccdntRcd) {
        return service.personnelAccidentRecord(psnAccdntRcd);
    }

    @PassToken
    @PostMapping("/revokePersonnelAccidentRecord")
    public ResultVo<String> revokePersonnelAccidentRecord(@RequestBody RvkPsnRcd rvkPsnRcd) {
        return service.revokePersonnelAccidentRecord(rvkPsnRcd);
    }

    @PassToken
    @PostMapping("/birthRecord")
    public ResultVo<String> birthRecord(@RequestBody BirthRcd birthRcd) {
        return service.birthRecord(birthRcd);
    }

    @PassToken
    @PostMapping("/revokeBirthRecord")
    public ResultVo<String> revokeBirthRecord(@RequestBody RvkPsnRcd rvkPsnRcd) {
        return service.revokeBirthRecord(rvkPsnRcd);
    }

    @GetMapping("/selectAllSpcSlwRcds")
    public ResultVo<List<SlwSpcDiseRcd>> selectAllSpcSlwRcds(@RequestParam("begntime") String begntime,
                                                             @RequestParam("endtime") String endtime) {
        return service.selectAllSpcSlwRcds(begntime, endtime);
    }
}
