package com.diagbot.web;

import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.PrintRecordFacade;
import com.diagbot.vo.PrintRecordsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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 javax.validation.Valid;

/**
 * @author wangfeng
 * @Description: 打印记录表 前端控制器
 * @date 2018年11月19日 上午10:03:12
 */
@RestController
@RequestMapping("/printRecord")
@Api(value = "打印记录API[by:wangfeng]", tags = { "WF——打印记录API" })
@SuppressWarnings("unchecked")
public class PrintRecordController {

    @Autowired
    PrintRecordFacade printRecordFacade;

    @ApiOperation(value = "保存打印记录[by:wangfeng]", notes = "疾病名称 :name</br>医生id:doctorId</br>医院编码 : hospitalId</br>"
            + "患者id:patientId</br>"
            + "医院部门id:hospitalDeptId</br> 问诊号:inquiryCode</br>文本内容 :content </br>{chief;//主诉present;//现病史other;//其他史vital;//查体lis;//化验pacs;//辅检diag;//诊断advice;//医嘱}</br>dataJson:内容JSON字符串(打印页面展示)")
    @PostMapping("/savePrintRecords")
    @SysLogger("savePrintRecords")
    @Transactional
    public RespDTO<Boolean> savePrintRecords(@Valid @RequestBody PrintRecordsVO printRecordsVO) {

        boolean res = printRecordFacade.savePrintRecord(printRecordsVO);

        return RespDTO.onSuc(res);
    }

}
