import React, { Component } from 'react';
import style from './index.less';
import LastDrug from './LastDrug/index.jsx';
import info2 from './../img/info2.png';
import info3 from './../img/info3.png';
import $ from "jquery";

class DrugHistory extends Component {
    constructor(props){
        super(props);
        this.state = {
            currentIndex: -1    
        }
    }
   

    render() {
        const { icon, titleStyle,titleBg, filter, title, drugHistory, showDrugInfo, setDrugInfo } = this.props
        return(
            (drugHistory['慢病用药内容'] && drugHistory['慢病用药内容'].length > 0 || drugHistory['普通病用药内容'] && drugHistory['普通病用药内容'].length > 0) &&
            <div className={style['last-treat-wrapper']}>
                <div className={style['last-treat-title-box']} style={titleStyle}></div>
                <div className={style['last-treat-title']} ><img className={style['last-treat-icon']} src={icon}/>{title}</div>
                {drugHistory['普通病用药内容'] && drugHistory['普通病用药内容'].length > 0 && <LastDrug title='普通病用药内容' lastDrugList = {drugHistory['普通病用药内容']}  showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
                {drugHistory['慢病用药内容'] &&drugHistory['慢病用药内容'].length > 0 && <LastDrug title='慢病用药内容' lastDrugList = {drugHistory['慢病用药内容']}  showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
            </div>
        )
    }

}

export default DrugHistory;
