import React, { Component } from "react";
import style from "./index.less";

class PatInfo extends Component {
  constructor(props){
    super(props)
  }
  componentWillMount() {
    const { getMessage } = this.props;
    getMessage && getMessage()
  }

  render(){
    const {message} = this.props.patInfo;
    const {sizeFlag} = this.props;
     return <table className={sizeFlag?`${style["table"]} ${style["newSize"]}`:style["table"]}>
      <tr>
        <td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`} title={'卡号:' + (message.patientIdNo && message.patientIdNo)}>卡号：{message.patientIdNo && message.patientIdNo}</td>
        <td key='2' className={`${style.tdBorderB} ${style.tdBorderR}`} title={sizeFlag&&message.patientName&&message.patientName.length>3?message.patientName:''}>姓名：{sizeFlag&&message.patientName && message.patientName.length>3?message.patientName.slice(0,3)+'...':message.patientName}</td>
        <td key='3' className={`${style.tdBorderB} ${style.tdBorderR}`}>年龄：{message.patientAge && message.patientAge}</td>
        <td key='4' className={`${style.tdBorderB} ${style.tdBorderR}`}>性别：{message.patientSex && message.patientSex}</td>
      </tr>
      <tr>
        <td key='5' className={`${style.tdBorderR}`} style={{whiteSpace: 'nowrap'}} title={'就诊时间：'+(message.systemTime&&message.systemTime.substring(0, 10))}>就诊时间：{message.systemTime&&message.systemTime.substring(0, 10)}</td>
        <td key='6' className={`${style.tdBorderR}`}>科室：{message.hospitalDeptName && message.hospitalDeptName}</td>
        <td key='7' className={`${style.tdBorderR}`} title={sizeFlag&&message.doctorName&&message.doctorName.length>3?message.doctorName:''}>医生：{sizeFlag&&message.doctorName && message.doctorName.length>3?message.doctorName.slice(0,3)+'...':message.doctorName}</td>
        <td key='8' className={`${style.tdBorderR}`} title={'门诊号：'+(message.recordId && message.recordId)}>门诊号：{message.recordId && message.recordId}</td>
      </tr>
    </table>;
  }
}

export default PatInfo;
