package thyyxxk.webserver.controller.zhuyuanyizheng.emr;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrLimitUnlock;
import thyyxxk.webserver.entity.zhuyuanyisheng.emrcontrolrule.*;
import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrControlRuleSever;

import javax.servlet.http.HttpServletResponse;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/emrControlRule")
public class EmrControlRuleController {
    private final EmrControlRuleSever server;

    public EmrControlRuleController(EmrControlRuleSever server) {
        this.server = server;
    }


    @PostMapping("/exportExcelUnlock")
    @PassToken
    public void exportExcelUnlock(HttpServletResponse response, @RequestBody SelectUnlockParam param) {
        server.exportExcelUnlock(response, param);
    }

    @PostMapping("/requestToUnlockMedicalRecords")
    public ResultVo<String> requestToUnlockMedicalRecords(@RequestBody EmrLimitUnlock param) {
        return server.requestToUnlockMedicalRecords(param);
    }


    @PostMapping("/getApplicationData")
    public ResultVo<IPage<EmrLimitUnlock>> getApplicationData(@RequestBody SelectUnlockParam param) {
        return server.getApplicationData(param);
    }


    @PostMapping("/reviewMedicalRecordsToUnlock")
    public ResultVo<String> reviewMedicalRecordsToUnlock(@RequestBody EmrLimitUnlock param) {
        return server.reviewMedicalRecordsToUnlock(param);
    }

    @GetMapping("/getMyUnlockByPatNo")
    public ResultVo<EmrLimitUnlock> getMyUnlockByPatNo(@RequestParam("patNo") String patNo,
                                                       @RequestParam("times") Integer times) {
        return server.getMyUnlockByPatNo(patNo, times);
    }

}
