package com.diagbot.facade;

import com.diagbot.entity.PrintRecord;
import com.diagbot.service.impl.PrintRecordServiceImpl;
import com.diagbot.util.DateUtil;
import com.diagbot.util.GsonUtil;
import com.diagbot.vo.PrintRecordsVO;
import org.springframework.stereotype.Component;

/**
 * @author wangfeng
 * @Description: 打印记录
 * @date 2018年11月19日 上午10:04:42
 */
@Component
public class PrintRecordFacade extends PrintRecordServiceImpl {

    /**
     * 保存打印记录
     *
     * @param printRecordsVO
     * @return boolean
     */
    public boolean savePrintRecord(PrintRecordsVO printRecordsVO) {
        //获取传入的参数值，保存在数据表中
        PrintRecord printRecord = new PrintRecord();
        printRecord.setCreator(printRecordsVO.getDoctorId().toString());//创建人id
        printRecord.setDoctorId(printRecordsVO.getDoctorId());//医生
        printRecord.setGmtCreate(DateUtil.now());//创建时间
        printRecord.setName(printRecordsVO.getName());//打印的名称
        printRecord.setHospitalDeptId(printRecordsVO.getHospitalDeptId());//部门id
        printRecord.setHospitalId(printRecordsVO.getHospitalId());//医院id
        printRecord.setInquiryCode(printRecordsVO.getInquiryCode());//就诊号
        printRecord.setPatientId(printRecordsVO.getPatientId());//患者id
        printRecord.setContent(GsonUtil.toJson(printRecordsVO.getContent()));//文件展现
        printRecord.setDataJson(printRecordsVO.getDataJson());//打印数据json
        boolean res = save(printRecord);
        return res;
    }


}
