package com.fs.app.controller;

import com.fs.app.annotation.Login;
import com.fs.app.facade.Hospital580FacadeService;
import com.fs.common.core.domain.PageResponse;
import com.fs.common.core.domain.Result;
import com.fs.common.core.page.PageRequest;
import com.fs.hospital580.vo.req.DiseaseReq;
import com.fs.hospital580.vo.req.PrescriptionListReq;
import com.fs.hospital580.vo.req.SaveOrderScrmReq;
import com.fs.hospital580.vo.res.DiseaseQueryRes;
import com.fs.hospital580.vo.res.PrescriptionDetailRes;
import com.fs.hospital580.vo.res.PrescriptionListRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@RestController
@RequestMapping("/hospital580/app")
@Slf4j
@Api(tags = "处方相关接口")
public class Hospital580Controller extends AppBaseController {

    @Autowired
    private Hospital580FacadeService hospital580FacadeService;

    @ApiOperation(value = "新增问诊单接口")
    @Login
    @PostMapping("/savePreDemand")
    public Result<String> savePreDemand(@RequestBody @Valid SaveOrderScrmReq vo) {
        return hospital580FacadeService.savePreDemand(vo);
    }

    @ApiOperation(value = "查询诊断类型列表")
    @PostMapping("/diseaseQueryList")
    public PageResponse<DiseaseQueryRes> diseaseQuery(@RequestBody DiseaseReq req) {
        return hospital580FacadeService.diseaseQuery(req);
    }


    @ApiOperation(value = "处方订单列表")
    @Login
    @PostMapping("/prescriptionList")
    public PageResponse<PrescriptionListRes> prescriptionList(@RequestBody PrescriptionListReq pageRequest) {
        return hospital580FacadeService.prescriptionList(getUserId(), pageRequest);
    }

    @ApiOperation(value = "处方订单详情")
    @Login
    @PostMapping("/prescriptionDetail/{preId}")
    public Result<PrescriptionDetailRes> prescriptionDetail(@PathVariable("preId") Long preId) {
        return hospital580FacadeService.prescriptionDetail(getUserId(), preId);
    }
}
