/*
 * Creator:     ML
 * CreatDate:   2020-03-22
 * descripts：  患者中心 治疗记录详情
 * */
// 添加就诊人
import React from 'react';
import { Toast, List, TextareaItem, } from 'antd-mobile';
// import { createForm } from 'rc-form';
// import { $http } from "containers/config/https";
// import { Util } from 'tools';
import './style/index.less';
// import moment from 'moment';
// const Item = List.Item;
class TreatmentRecordDetail extends React.Component {
    constructor({ history }) {
        super();
        let userData = localStorage.getItem("userData") ? JSON.parse(localStorage.getItem("userData")) : {};
        this.state = {
            userData,
            errorData: {},
            number: 1,
            frequence:1,//每天次数
            ordDose:1,//每次数量
            durQty:1,//疗程天数
        };
        this.history = history;
    }

    componentDidMount = () => {
       
    }

    componentWillUnmount() {
        // 组件销毁前将静止让setState修改state的状态
        this.setState = (state, callback) => { return; }
    }

    // 获取数量
    handleVerification = (type, e) => {
        this.setState({
            [type]: e
        })
    }



    // 点击显示错误信息
    onErrorClick = (key) => {
        let { errorData } = this.state;
        if (errorData[key]) {
            let errorMessage = errorData[key].errors[0].message;
            Toast.info(errorMessage);
        }
    }

    // 验证成功去除验证警告
    removeWarning = (key) => {
        let obj = JSON.parse(JSON.stringify(this.state.errorData))
        obj[key] = false
        this.setState({ errorData: obj })
    }

    render() {
        // let { errorData, info } = this.state;
        return (
            <div className="apply-dom treatmentRecordDatail-dom patientCenter-dom">
                <form>
                   <div>
                   <List>
                        <div className="title">
                            <p>
                            <span>治疗开始时间</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.startDate}</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.startTime}</span>
                            </p>
                        </div>
                    </List>
                    <List>
                        <div className="title ">
                            <p>
                            <span>治疗结束时间</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.endDate}</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.endTime}</span>
                            </p>
                        </div>
                    </List>
                    <List>
                        <div className="title ">
                            <p>
                            <span>治疗结束时长</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.dateTime}</span>
                            </p>
                        </div>
                    </List>
                    <List>
                        <div className="title title-doctor">
                            <p>
                            <span>治疗医生</span>
                            <span> {this.props.location.state&&this.props.location.state && this.props.location.state.cureDoctorDesc}</span>
                            </p>
                        </div>
                    </List>        
                        <List>
                            {
                               this.props.location.state&&this.props.location.state && this.props.location.state.evaluationArr?this.props.location.state.evaluationArr.map((item,i)=>{
                               return(
                                <div className="title title-doctor">
                                <p style={{display:"flex",alignItems:"center"}}>
                               <span style={{width:"92px",display:"inline-block",textAlign:"left",marginRight:"12px",whiteSpace:"pre-wrap"}}>{item.evaluation}</span>
                                <span> {item.fieldValue}</span>
                                </p>
                               </div>
                               )
                               }):""
                            }
                        </List>
                    <div className="title"><p><span>治疗计划：</span></p></div>
                    <TextareaItem
                        rows={3}
                        disabled={true}
                        value={this.props.location.state&&this.props.location.state && this.props.location.state.curePlan}
                    />
                     <div className="title"><p><span>备注</span></p></div>
                    <TextareaItem
                        rows={3}
                        disabled={true}
                        value={this.props.location.state&&this.props.location.state && this.props.location.state.cureNote}
                    />
                     <div>
                     </div>
                   </div>
                </form>
            </div>
        )
    }
};
export default TreatmentRecordDetail;