package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.GetTopPatientInfoDTO;
import com.diagbot.dto.PatientInfoDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.PatientInfoFacade;
import com.diagbot.vo.GetTopPatientInfoVO;
import com.diagbot.vo.PatientInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;

/**
 * <p>
 * 患者信息表 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2018-11-19
 */
@RestController
@RequestMapping("/patientInfo")
@Api(value = "患者信息API", tags = { "患者信息API" })
@SuppressWarnings("unchecked")
public class PatientInfoController {
    @Autowired
    private PatientInfoFacade patientInfoFacade;

    @ApiOperation(value = "患者信息——查询[by:wangyu]",
            notes = "patientCode：患者编号，必填<br>" +
                    "hospitalCode:医院编号，必填<br>")
    @PostMapping("/getPatientInfo")
    @SysLogger("getPatientInfo")
    @ApiIgnore
    public RespDTO<PatientInfoDTO> getPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) {
        PatientInfoDTO data = patientInfoFacade.getPatientInfo(patientInfoVO);
        return RespDTO.onSuc(data);
    }


    @ApiOperation(value = "页面顶部病人医生科室信息——查询[by:rengb]",
            notes = "hospitalCode：医院编号，必填<br>" +
                    "hospitalDeptCode：医院科室编号，必填<br>" +
                    "doctorCode：医院医生编号，必填<br>" +
                    "patientCode:医院患者编号，必填<br>")
    @PostMapping("/getTopPatientInfo")
    @SysLogger("getTopPatientInfo")
    public RespDTO<GetTopPatientInfoDTO> getTopPatientInfo(@Valid @RequestBody GetTopPatientInfoVO getTopPatientInfoVO) {
        return RespDTO.onSuc(patientInfoFacade.getTopPatientInfo(getTopPatientInfoVO));
    }

}
