// 传染病上报弹框
import React, { Component } from 'react';
import {
    Button,
    Checkbox,
    Col,
    DatePicker,
    Form,
    Icon,
    Input,
    message,
    Modal,
    Radio,
    Row,
    Select,
    TimePicker,
    Tooltip
} from 'antd';
import FormItem from 'antd/lib/form/FormItem';
import { $http } from '../../../containers/config/https';
import PatientInfo from '../Patient/PatientInfo.jsx';
import { Util } from 'tools/index';
import moment from 'moment';
import store from 'store';
import './style/InfectiousModel.less';
import { $loadTemplate } from '../../lodop/Common/Print.js';

let { Option } = Select;


// 用户数据
let userData;
// 点击编辑时记录当前行数据
let tableRecord = {};
//患者信息
let patientData;
// 创建表单
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};
const formItemEquip = {    // label 和input宽度
    labelCol: { span: 4 },
    wrapperCol: { span: 20 },
};
const formItemLayoutAdd = {    // label 和input宽度
    labelCol: { span: 1 },
    wrapperCol: { span: 23 },
};

const formItemLayoutCheck = {
    labelCol: { span: 7 },
    wrapperCol: { span: 25 },
}
const radioLayoutAdd = {
    labelCol: { span: 4 },
    wrapperCol: { span: 20 },
}
const radioLayout = {    // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};
const radioLayoutInput = {
    labelCol: { span: 4 },
    wrapperCol: { span: 9 },
}
const radioLayoutInput2 = {
    labelCol: { span: 14 },
    wrapperCol: { span: 10 },
}
const radioLayoutDate = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
}

const InfectiousModel = Form.create()(
    class extends Component {
        constructor(props) {
            super(props);
            userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {}
            patientData = JSON.parse(sessionStorage.getItem('patientData'))
            this.state = {
                patientData: patientData,
                visible: false,
                invoiceValue: '',
                loading: false,
                dataSource: [],
                patInfo: {},
                admInfo: {},
                selectData: [],
                showDialog: false,
                indexTable: '',
                visStatus: false,
                changeValue: '',
                editData: [],
                baseParms: {},
                data: {},
                occu: [],//人群
                belongTo: [],//患者属于
                caseClass: [],//病例分类
                disease: [],
                diseaseID: '',
                province: [],// 省数据
                firstCity: [],//第一次请求到的市
                presentAreas: [],
                statusCode: 'NULL',//状态
                btn1: "^pending",  //审核按钮对应状态
                btn2: "^pending",  //保存修改按钮对应状态
                btn3: "^pending",  //退回按钮对应状态
                btn4: "^pending^othReported",  //作废按钮对应状态
                btn5: "^reviewed^revise",  //取消按钮对应状态
                btn6: "^reviewed^revise",  //订正按钮对应状态
                btn7: "^reviewed^revise",  //上报CDC按钮对应状态
                btn8: "^return",  //重新报卡按钮对应状态
                btn9: "^draft^return^NULL", //草稿按钮对应状态
                btn10: "^draft^NULL", //上报对应状态
                btn11: "^draft^pending^return^NULL", //外院已报按钮对应状态

                presentCity: [],//籍贯市区信息
                presentVillages: [],//籍贯乡信息
                presentHamlets: [],//籍贯村落信息

                patCredTypeID: "",       //患者证件类型
                contactCredTypeID: "",   //紧急联系人证件类型
                patCredNo: "",           //患者证件号
                contactCredNo: "",       //联系人证件号
                visibleSuccess: false,
                //提示信息
                tipsPresentAddressDesc: "",
                admID: "",
                tableData: [],
                locType: '',             // 科室类型
                infectionsData: {},
                ENObj: {},
                CNObj: {},
                provinceID: '',
                cityID: '',
                areaID: '',
                villageID: '',
                hamletID: '',
                address: '',
                contactPhone: '',
                credTypeID: '',
                credNo: '',
                patientPhone: '',
                parentName: '',
                parentFlag: false
            }
            this.credNo = React.createRef();
        }
        componentDidMount() {
            this.props.onRef(this);
            this.getDetailColumns();
            let self = this;
            this.setState({
                showLoading: false
            })
            document.addEventListener("keydown", function (e) {
                self.KeyDowns(e)
            })


            // this.handleWSCallTest(1,{
            //     "type": "WSDL",
            //     "URL": "/wsdl",
            //     "methodName": "ser:getChinaXml",
            //     "paramArray": [
            //     // {"dataName":"theRegionCode", "dataType": "string", "dataContent": "31123"},
            //     {"dataName":"userName", "dataType": "string", "dataContent": "?"},
            //     {"dataName":"passWord", "dataType": "string", "dataContent": "?"},
            //     {"dataName":"signature", "dataType": "string", "dataContent": "?"},
            //     {"dataName":"timestamp", "dataType": "string", "dataContent": "?"},
            //     {"dataName":"nonce", "dataType": "string", "dataContent": "?"},
            //     {"dataName":"eventId", "dataType": "string", "dataContent": "cid:310160386982"}
            //     ]
            // })
        }

        componentWillReceiveProps(nextProps) {
            // console.log(nextProps, nextProps.hasOwnProperty('diseaseID'))
            if (nextProps && nextProps.diseaseID && nextProps.diseaseID !== this.state.diseaseID) {
                this.setState({
                    diseaseID: nextProps.diseaseID,
                    statusCode: 'NULL',
                }, () => {
                    this.handleSearch();
                })
            }
        }

        //查询
        handleSearchDefault = () => {
            let data = {
                params: [{
                    admID: patientData && patientData.admID ? patientData.admID : '',
                }]
            };
            $http.post('urlS', this, {
                code: '04190014',
                data: data,
                success: (res) => {
                    // console.log(res,"res")
                    if (res.errorCode === "0" && !Util.isEmpty(res.result)) {
                        this.setState({
                            provinceID: res.result.provinceID,
                            cityID: res.result.cityID,
                            areaID: res.result.areaID,
                            areaDesc: res.result.areaDesc,
                            villageID: res.result.villageID,
                            hamletID: res.result.hamletID,
                            villageDesc: res.result.villageDesc,
                            address: res.result.address,
                            contactPhone: res.result.contactPhone,
                            credTypeID: res.result.credTypeID,
                            credNo: res.result.credNo,
                            patientPhone: res.result.patientPhone,
                            parentName: res.result.parentName,
                            parentFlag: res.result.parentFlag == 'false' ? false : true,
                        });
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }

        // 获取列表头数据
        getDetailColumns = () => {
            let { userInfo } = this.state;
            let data = {
                params: [{
                    reactCode: ['InfectiousModel'],
                    compontName: 'InfectiousModel',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            ENObj: res.result.language.EN,
                            CNObj: res.result.language.CN
                        })
                    }
                }
            })
        };
        // 打开弹窗
        showModal = (data) => {
            //   console.log('y656656565656',data)
            this.loadBaseParms();
            this.loadInfo();
            this.handleInfo();
            this.handleSearchDefault();
            this.setState({ visible: true, infectionsData: data });
        }

        // 关闭弹窗
        handleCancel = () => {
            this.setState({
                visible: false,
                tableData: []
            }, () => {
                if (!Util.isEmpty(this.props.handleQuery)) {
                    this.props.handleQuery();
                    this.resetFields();
                }
                if (!Util.isEmpty(this.props.saveDiag)) {
                    this.props.saveDiag();
                    this.resetFields();
                }
            });
        }
        // 关闭弹窗
        handleCancel1 = () => {
            this.setState({
                visible: false,
                tableData: []
            }, () => {
                if (!Util.isEmpty(this.props.handleQuery)) {
                    this.props.handleQuery();
                    this.resetFields();
                }
            });
        }
        //获取人群分类下拉数据
        loadInfo() {
            var params = {
                params: [{

                }]
            }
            $http.post('urlDeault', this, {
                code: "04190010",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.setState({
                            occu: res.result.occu,
                            caseClass: res.result.caseClass,
                            belongTo: res.result.belongTo,
                            disease: res.result.disease,
                            locType: res.result.locType,
                        })
                    }
                }
            });
        }
        KeyDowns = (e) => {
            if (e) {
                e.stopPropagation();
                //  this.handleReset();
            }
        }
        handleReset = () => {
            this.props.form.resetFields();
            this.setState({
                presentCity: [],//籍贯市区信息
                presentAreas: [],//籍贯县信息
                presentVillages: [],//籍贯乡信息
                presentHamlets: [],//籍贯村落信息
                patCredTypeID: "", //患者证件类型
                //提示信息
                tipsPresentAddressDesc: "",

            })
        }
        //加载下拉框信息
        loadBaseParms = () => {
            let data = {}
            data = {
                params: [{
                    credTypeFlag: 1,//证件类型
                    countryFlag: 1,	//国家
                    ageUnitFlag: '',
                    payMethodFlag: '',
                    provinceFlag: 1,	//省
                    cityFlag: 1,  //市
                }]
            }
            $http.post('urlS', this, {
                code: '03030005',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            baseParms: res,
                            province: res.province,
                            firstCity: res.city,
                        })
                    }
                }
            })
        }
        //选择或清除省
        onProvinceChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    provinceID: '',
                    cityID: '',
                    areaID: '',
                    villageID: '',
                    hamletID: '',
                });
                let city = []
                city = this.state.firstCity.filter((item) => item.province == value);
                let patInfo = this.state.patInfo;
                let patFlag = this.firstToUp(flag);
                if (patInfo["pat" + patFlag + "ProvinceID"]) {
                    patInfo["pat" + patFlag + "ProvinceID"] = undefined;
                    patInfo["pat" + patFlag + "CityID"] = undefined;
                    patInfo["pat" + patFlag + "AreaID"] = undefined;
                    patInfo["pat" + patFlag + "VillageID"] = undefined;
                    patInfo["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "City"]: city,
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    patInfo: patInfo,
                })
            } else {
                //清除省
                this.props.form.setFieldsValue({
                    provinceID: '',
                    cityID: '',
                    areaID: '',
                    villageID: '',
                    hamletID: '',
                });
                let patInfo = this.state.patInfo;
                let patFlag = this.firstToUp(flag);
                if (patInfo["pat" + patFlag + "ProvinceID"]) {
                    patInfo["pat" + patFlag + "ProvinceID"] = undefined;
                    patInfo["pat" + patFlag + "CityID"] = undefined;
                    patInfo["pat" + patFlag + "AreaID"] = undefined;
                    patInfo["pat" + patFlag + "VillageID"] = undefined;
                    patInfo["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "City"]: [],
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    patInfo: patInfo,
                })
            }
        }
        //首字母大写
        firstToUp = (str) => {
            return str.substring(0, 1).toUpperCase() + str.substring(1);

        }

        onCityFocus = (provinceFlag, cityFlag) => {
            let city = this.state[cityFlag];
            let provinceID = this.props.form.getFieldValue(provinceFlag);
            if ((city.length === 0) && (provinceID)) {
                let newCity = []
                newCity = this.state.firstCity.filter((item) => item.province == provinceID);
                this.setState({
                    [cityFlag]: newCity,
                })
            }
        }
        //选择或清除市
        onCityChange(flag, value, option) {
            if (!Util.isEmpty(value)) {
                this.getAreas(value, flag, "1");
                this.props.form.setFieldsValue({
                    areaID: '',
                    villageID: '',
                    hamletID: ''
                });
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    cityID: '',
                    areaID: '',
                    villageID: '',
                    hamletID: '',
                    ZIP: undefined,
                });
                this.setState({
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                })
            }
        }
        //选择市时加载县数据
        getAreas(cityID, flag, cleanFlag) {
            let data = {
                params: [{
                    cityId: cityID
                }],
            }
            $http.post('urlS', this, {
                code: '03030006',
                data: data,
                success: function (res) {
                    if (res.errorCode == '0') {
                        if (cleanFlag === "1") {
                            this.state.presentVillages = []
                            this.state.presentHamlets = []
                        }
                        this.state.presentAreas = res.result
                        this.setState({})

                    }

                }
            })

        }
        //选择或清除县
        onAreaChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    villageID: '',
                    hamletID: '',
                    ZIP: option.props.zip,
                });
                this.getVillages(value, flag, "1");
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    villageID: '',
                    hamletID: '',
                    ZIP: undefined,
                });
                let patInfo = this.state.patInfo;
                let patFlag = "";
                switch (flag) {
                    case "birth":
                        patFlag = "Birth";
                        break;
                    case "native":
                        patFlag = "Native";
                        break;
                    case "present":
                        patFlag = "Present";
                        break;
                    case "register":
                        patFlag = "Register";
                        break;
                    case "company":
                        patFlag = "Company";
                        break;
                    case "contact":
                        patFlag = "Contact";
                        break;
                }
                if (patInfo["pat" + patFlag + "AreaID"]) {
                    patInfo["pat" + patFlag + "AreaID"] = undefined;
                    patInfo["pat" + patFlag + "VillageID"] = undefined;
                    patInfo["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    patInfo: patInfo,
                })
            }
        }
        //县获取焦点
        onAreaFocus(cityFlag, areaFlag) {
            let areaID = this.state[areaFlag + "Areas"];
            let cityID = this.props.form.getFieldValue(cityFlag);
            if ((areaID.length === 0) && (cityID)) {
                this.getAreas(cityID, areaFlag, "0");
            }
        }

        //选择县时加载乡数据
        getVillages = (countyID, flag, cleanFlag) => {
            let data = {
                params: [{
                    areaId: countyID,
                }],
            }
            $http.post('urlS', this, {
                code: '03030007',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        if (cleanFlag === "1") {
                            this.setState({
                                [flag + "Villages"]: res.result,
                                [flag + "Hamlets"]: [],
                            })
                        } else {
                            this.setState({
                                [flag + "Villages"]: res.result,
                            })
                        }
                    } else {
                        this.setState({
                            [flag + "Villages"]: [],
                            [flag + "Hamlets"]: [],
                        })
                    }
                }
            })

        }
        //选择县或清除乡
        onVillageChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    hamletID: '',
                    ZIP: option.props.zip,
                });
                this.getHamlets(value, flag);
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    hamletID: '',
                    ZIP: undefined
                });
                let patInfo = this.state.patInfo;
                let patFlag = "";
                if (patInfo["pat" + patFlag + "VillageID"]) {
                    patInfo["pat" + patFlag + "VillageID"] = undefined;
                    patInfo["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "Hamlets"]: [],
                    patInfo: patInfo,
                })
            }
        }
        //乡获取焦点时调用
        onVillageFocus(areaFlag, villageFlag) {
            let village = this.state[villageFlag + "Villages"];
            let areaID = this.props.form.getFieldValue(areaFlag);
            if ((village.length === 0) && (areaID)) {
                this.getVillages(areaID, villageFlag, "0");
            }
        }
        //选择乡时加载村数据
        getHamlets = (villageID, flag) => {
            let data = {
                params: [{
                    villageId: villageID
                }],
            }
            $http.post('urlS', this, {
                code: '03030008',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            [flag + "hamlets"]: res.result,
                        })
                    } else {
                        this.setState({
                            [flag + "hamlets"]: [],
                        })
                    }
                }
            })

        }
        onHamletFocus(villageFlag, hamletsFlag) {
            let hamlets = this.state[hamletsFlag + "Hamlets"];
            let villageID = this.props.form.getFieldValue(villageFlag);
            if ((hamlets.length === 0) && (villageID)) {
                this.getHamlets(villageID, hamletsFlag);
            }
        }

        //元素获取焦点时触发
        onFocus = (flag, e) => {
            let tipsFlag = "tips" + this.firstToUp(flag);
            this.setState({
                [tipsFlag]: "",
            })
        }
        //证件类型改变
        onCredTypeChange(flag, value) {
            this.setState({
                [flag]: value || "",
            })
        }
        //获取患者信息
        getPatInfoByCredNo = (credTypeID, credNo) => {
            var params = {
                params: [{
                    credTypeID: credTypeID,
                    credNo: credNo,
                }]
            }
            $http.post('urlDeault', this, {
                code: "03040019",
                data: params,
                success: function (res) {
                    if (res.errorCode === '0') {
                        if (Util.isEmpty(res.patInfo.credNo)) {
                            this.setState({
                                patInfo: {},
                                admInfo: {},
                                patAdminInfo: {},
                                readInfoLoading: false,
                                adminListVisible: false,
                                credTypeID: credTypeID,
                            })
                            return;
                        }
                        this.setState({
                            checkData: res.patInfo,
                            isShowCorrelationModal: res.patInfo.credNo ? true : false,
                            checkMsg: res.message
                        })
                    }
                }
            });
        }
        //证件号失去焦点或回车时调用
        patCredNoTip = (e) => {
            let data = e.target.value;
            if (!data || data.length === 0) {
                this.setState({
                    tipsPatCredNo: "",
                    credNo: "",
                })
                return;
            }
            let credTypeID = this.props.form.getFieldValue('credTypeID');
            this.props.form.validateFields(['credNo',], (errors, values) => {
                if (!errors) {
                    if (this.state.patInfo.credNo !== data) {

                        if (credTypeID == '1') {
                            this.setState({
                                tipsPatCredNo: "",
                                credNo: data,
                                tipsPatSexID: "",
                            })
                            if (data.length == 18) {
                                this.getAge(data);
                                this.props.form.setFieldsValue({ patSexID: this.getSex(data), patBirthDateTime: moment(this.getBirthday(data)) });
                            }
                        } else {
                            this.setState({
                                tipsPatCredNo: "",
                                credNo: data,
                            })
                        }
                        if (e.keyCode == 13) {
                            this.credNo.current.blur();
                            this.getPatInfoByCredNo(patCredTypeID, data);
                        }
                    }
                } else {
                    this.setState({
                        tipsPatCredNo: errors.credNo.errors[0].message,
                        credNo: "",
                    })
                }
            });
        }
        //获取身份证号年龄
        getAge = (credNo) => {
            var len = (pcredNo + "").length;
            if (len == 0) {
                return 0;
            } else {
                if ((len != 15) && (len != 18))//身份证号码只能为15位或18位其它不合法
                {
                    return 0;
                }
            }
            var strBirthday = "";
            if (len == 18)//处理18位的身份证号码从号码中得到生日和性别代码
            {
                strBirthday = credNo.substr(6, 4) + "-" + credNo.substr(10, 2) + "-" + credNo.substr(12, 2);
            }
            if (len == 15) {
                strBirthday = "19" + credNo.substr(6, 2) + "-" + credNo.substr(8, 2) + "-" + credNo.substr(10, 2);
            }
            this.autoAge(strBirthday)
        }
        ///需要提醒的Input元素失去焦点
        onTipsItemBlur(flag, title, e) {
            const value = this.props.form.getFieldValue(flag);
            let tipsFlag = "tips" + this.firstToUp(flag);
            let msg = "";
            if (!value || (value === "")) {
                msg = title;
            }
            this.setState({
                [tipsFlag]: msg,
            })
        }
        //急性
        acuteClick = (e) => {
            let { patInfo } = this.state
            patInfo.acute = patInfo.acute === 'Y' ? 'N' : 'Y'
            this.setState({
                patInfo: patInfo
            })

        }
        //慢性
        chronicClick = (e) => {
            let { patInfo } = this.state
            patInfo.chronic = patInfo.chronic === 'Y' ? 'N' : 'Y'
            this.setState({
                patInfo: patInfo
            })

        }
        //未分型
        unclassifiedClick = (e) => {
            let { patInfo } = this.state
            patInfo.unclassified = patInfo.unclassified === 'Y' ? 'N' : 'Y'
            this.setState({
                patInfo: patInfo
            })
        }
        // 保存用户信息表单提交
        handleSubmit = (code) => {
            this.setState({
                clickFlag: true,
                editingKey: '',
            });
            const infectionsData = this.state.infectionsData
            const formData = this.props.form.getFieldsValue();
            this.props.form.validateFields((err, values) => {
                if (err) {  //!err
                    this.setState({
                        clickFlag: false,
                        disabledAll: false
                    });
                    message.warn('请输入完整信息');
                } else {
                    let tableData = this.state.tableData;
                    let subCardInfo = []
                    if (!Util.isEmpty(tableData)) {
                        for (let i = 0; i < tableData.length; i++) {
                            let dataObj = {};
                            dataObj.reportID = !Util.isEmpty(this.props.reportID) ? this.props.reportID : '';
                            dataObj.subCardItemID = tableData[i]['id']
                            dataObj.value = formData[tableData[i]['code']];
                            subCardInfo.push(dataObj)
                        }
                        // console.log(subCardInfo)
                    }
                    let data = {
                        params: (code == 'draft' || code == 'pending' || code == 'othReported' || code == 'revise') ? [{
                            id: !Util.isEmpty(this.props.reportID) ? this.props.reportID : '',
                            admID: (!Util.isEmpty(infectionsData) && !Util.isEmpty(infectionsData.admID)) ? this.state.infectionsData.admID : (patientData && patientData.admID ? patientData.admID : ''),
                            diseaseID: formData.diseaseID ? formData.diseaseID : '',
                            diagDate: formData.diagDate ? moment(formData.diagDate).format('YYYY-MM-DD') : null,
                            diagTime: formData.diagTime ? moment(formData.diagTime).format('HH:mm') : null,
                            onsetDate: formData.onsetDate ? moment(formData.onsetDate).format('YYYY-MM-DD') : null,
                            onsetTime: formData.onsetTime ? moment(formData.onsetTime).format('HH:mm') : null,
                            dieDate: formData.dieDate ? moment(formData.dieDate).format('YYYY-MM-DD') : null,
                            dieTime: formData.dieTime ? moment(formData.dieTime).format('HH:mm') : null,
                            reportDate: formData.reportDate ? moment(formData.reportDate).format('YYYY-MM-DD') : null,
                            statusCode: code,
                            credTypeID: formData.credTypeID ? formData.credTypeID : '',
                            credNo: formData.credNo ? formData.credNo : '',
                            contactPhone: formData.contactPhone ? formData.contactPhone : '',
                            patientPhone: formData.patientPhone ? formData.patientPhone : '',
                            parentName: formData.parentName ? formData.parentName : '',
                            provinceID: formData.provinceID ? formData.provinceID : '',
                            cityID: formData.cityID ? formData.cityID : '',
                            areaID: formData.areaID ? formData.areaID : '',
                            villageID: formData.villageID ? formData.villageID : '',
                            hamletID: formData.hamletID ? formData.hamletID : '',
                            address: formData.address ? formData.address : '',
                            company: formData.company ? formData.company : '',
                            OCCU: formData.OCCU ? formData.OCCU : '',
                            belongTo: formData.belongTo ? formData.belongTo : '',
                            caseClassification: formData.caseClassification ? formData.caseClassification : '',
                            acute: this.state.patInfo.acute === 'Y' ? 'Y' : 'N',
                            chronic: this.state.patInfo.chronic === 'Y' ? 'Y' : 'N',
                            unclassified: this.state.patInfo.unclassified === 'Y' ? 'Y' : 'N',
                            notes: formData.notes ? formData.notes : '',
                            subCardInfo
                        }] : [{
                            id: this.props.reportID,
                            statusCode: code,
                            reportCDC: code == 'CDC' ? 'Y' : 'N',
                        }]

                    };
                    $http.post('urlADS', this, {
                        code: "04190011",
                        data: data,
                        success: function (res) {
                            if (+res.errorCode == '0') {
                                message.success('成功');

                                this.handleReset();
                                this.setState({
                                    clickFlag: false,
                                    statusCode: code
                                }, () => {
                                    this.handleCancel();
                                });
                            } else {
                                this.setState({ clickFlag: false, disabledAll: false })
                            }

                            //存在uploadParam 节点，调用webservice服务
                            if (res.result && res.result?.uploadParam?.type) {
                                this.handleWSCallTest(res.result?.id, res.result?.uploadParam);
                            }
                        },
                        error: function (error) {
                            message.error('失败：' + error);
                            this.setState({ clickFlag: false, disabledAll: false })
                        }
                    });
                }

            });
        };

        /**
         * "uploadParam": {
                "type": "WSDL",
                "URL": "http://",
                "methodName": "invoke",
                "paramArray": [{
                        "dataName": "name**"
                        "dataType": "string",
                        "dataContent": "1111"
                }]
            }
         * @ByYQL: 传染病上传webservice服务调用
         * Create 2023-3-28
         */
        handleWSCallTest = async (id, uploadParam) => {
            console.log('webservice0:', uploadParam);
            try {
                let xmlText = '';
                const xmlAry = uploadParam.paramArray;
                if (xmlAry && xmlAry.length > 0) {
                    xmlText = this.objectToXml(xmlAry);
                }
                // let xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                //     "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
                //     "<soap:Body>" +
                //     "<" + uploadParam.methodName + " xmlns=\"http://WebXml.com.cn/\">" +
                //         xmlText +
                //     "</" + uploadParam.methodName + ">" +
                //     "</soap:Body>" +
                //     "</soap:Envelope>";
                let xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                    "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://service.webService.sinosoft.com.cn/\">" +
                    "<soapenv:Header/>" +
                    "<soapenv:Body>" +
                    "<" + uploadParam.methodName + ">" +
                    xmlText +
                    "</" + uploadParam.methodName + ">" +
                    "</soapenv:Body>" +
                    "</soapenv:Envelope>";
                console.log('xmlData', xmlData);
                let res = await React.$wsPost(xmlData, uploadParam.URL);
                console.log('webservice1:', res);
                // this.saveWebReqResult(id, res);
            } catch (error) {
                console.log('webservice2:', error);
            }
        };

        //将js数组拼装成xml格式
        objectToXml = (object) => {
            let xml = '';
            for (let prop in object) {
                xml += "<" + object[prop].dataName + ">";
                if (object[prop].dataType === 'string') {
                    xml += object[prop].dataContent.toString();
                }
                if (object[prop].dataType === 'int') {
                    xml += parseInt(object[prop].dataContent);
                }
                if (object[prop].dataType === 'date') {
                    xml += this.getDateFromString(object[prop].dataContent);
                }
                if (object[prop].dataType === 'byte') {
                    xml += new TextEncoder().encode(object[prop].dataContent);
                }
                xml += "</" + object[prop].dataName + ">";
            }
            return xml;
        };

        //日期转为时间戳
        getDateFromString = (str) => {
            str = str.substring(0, 19);
            str = str.replace(/-/g, '/');
            return new Date(str).getTime();
        };

        //保存上传结果
        saveWebReqResult = (id, res) => {
            let data = {
                params: [{
                    id: id,
                    uploadResult: res
                }]
            };
            $http.post('urlS', this, {
                code: '04190017',
                data: data,
                success: (res) => {
                    if (+res.errorCode === 0) { } else { }
                }
            });
        };

        //查询
        handleInfo = () => {
            let data = {
                params: [{
                    reportID: !Util.isEmpty(this.props.reportID) ? this.props.reportID : '',
                }]
            };
            $http.post('urlS', this, {
                code: '04190012',
                data: data,
                success: (res) => {
                    if (res.errorCode === "0") {
                        let dataInfo = res.result.Data[0];
                        this.setState({
                            data: dataInfo.subCardInfo,
                            patInfo: dataInfo,
                            diseaseID: dataInfo.diseaseID,
                            statusCode: dataInfo.statusCode
                        }, () => this.handleSearch());
                    } else {
                        this.setState({
                            data: {}
                        });
                    }
                }
            });
        }
        // 重置表单
        resetFields = () => {
            this.props.form.resetFields();
        }
        //配置
        handleSearch = () => {
            let { diseaseID } = this.state;
            let data = {
                params: [{
                    diseaseID: diseaseID ? diseaseID : this.props.diseaseID
                }]
            };
            $http.post('urlS', this, {
                code: '04190003',
                data: data,
                success: (res) => {
                    // console.log(res);
                    if (res.errorCode === "0" && !Util.isEmpty(res.result)) {
                        this.setState({
                            tableData: res.result.data,
                        });
                    } else {
                        this.setState({
                            tableData: []
                        });
                    }
                }
            });
        }
        //获取传染病下拉框的值
        changeDisease = (e) => {
            this.setState({
                diseaseID: e,
            }, () => {
                this.handleSearch();
            });
        }

        printReport = () => {
            let data = {};
            data = {
                params: [{
                    reportID: !Util.isEmpty(this.props.reportID) ? this.props.reportID : '',
                }]
            }
            let templateCode = 'InfectiousReport';
            $http.post('urlS', this, {
                code: '04190016',
                data: data,
                success: function (res) {
                    if (res.errorCode === '0') {
                        //加载模板
                        $loadTemplate(templateCode, res.result);
                    }
                }
            })
        }

        displayData = (data) => {
            let userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {};
            return userData.language == "EN" ? data.ENDesc : data.descripts;
        }

        render() {
            let language = userData.language
            let languageObj = {}
            if (language == "EN") {
                languageObj = this.state.ENObj
            } else {
                languageObj = this.state.CNObj
            }
            const { getFieldDecorator } = this.props.form;
            let tablePanel = [];
            let locType = this.state.locType
            const infectionsData = this.state.infectionsData
            tablePanel.push(
                <Form key="tablePanel">
                    <div className="Infectious-left" style={{ height: '100%' }}>
                        {
                            this.state.tableData.map((item, itemIndex) => {
                                if (item.title == "Y") {
                                    return <Col key={itemIndex} span={24} style={{ width: '100%', padding: '0 12px' }}>{item.descripts}</Col>

                                } else {
                                    if (item.type == "S") {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 6} style={{ marginTop: '-10px' }}>
                                            <FormItem {...radioLayout} label={this.displayData(item)}>
                                                {getFieldDecorator(item.code, {
                                                    initialValue: !Util.isEmpty(this.state.data) ? this.state.data[item.code] : '',
                                                })(
                                                    <Select>
                                                        {
                                                            item.data.map((details, detailsIndex) => {
                                                                return (<Select value={details.code}>{this.displayData(details)}</Select>)
                                                            })
                                                        }
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                    } else if (item.type == "I") {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 20} style={{ marginTop: '-10px' }}>
                                            {!Util.isEmpty(item.data) ?
                                                <div>
                                                    <Col span={8}>
                                                        <FormItem {...radioLayoutInput2} label={this.displayData(item)}>
                                                            {getFieldDecorator(item.code, {
                                                                initialValue: !Util.isEmpty(this.state.data) ? this.state.data[item.code] : '',
                                                            })(
                                                                <Input />
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                    <Col span={10} style={{ marginTop: '8px' }}>
                                                        <span style={{ whiteSpace: "nowrap", paddingLeft: "10px" }}>
                                                            {item.data && item.data.length > 0 ? item.data[0].descripts : ''}
                                                        </span>
                                                    </Col>
                                                </div>
                                                :

                                                <FormItem {...radioLayoutInput} label={this.displayData(item)}>
                                                    {getFieldDecorator(item.code, {
                                                        initialValue: !Util.isEmpty(this.state.data) ? this.state.data[item.code] : '',
                                                    })(
                                                        <Input />
                                                    )}
                                                </FormItem>

                                            }

                                        </Col>

                                    } else if (item.type == "R") {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 24} style={{ marginTop: '-10px' }}>
                                            <FormItem {...radioLayoutAdd} label={this.displayData(item)}>
                                                {getFieldDecorator(item.code, {
                                                    initialValue: !Util.isEmpty(this.state.data) ? this.state.data[item.code] : '',
                                                })(
                                                    <Radio.Group>
                                                        {
                                                            item.data.map((details, detailsIndex) => {
                                                                return (<Radio value={details.code}>{this.displayData(details)}</Radio>)
                                                            })
                                                        }
                                                    </Radio.Group>
                                                )}
                                            </FormItem>
                                        </Col>
                                    } else if (item.type == "C") {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 24} style={{ marginTop: '-10px' }}>
                                            <FormItem {...radioLayoutAdd} label={this.displayData(item)}>
                                                {getFieldDecorator(item.code, {
                                                    initialValue: !Util.isEmpty(this.state.data) ? this.state.data[item.code] : '',
                                                })(<Checkbox.Group style={{ margin: '-10px', marginLeft: '2px' }}>
                                                    {
                                                        item.data.map((details, detailsIndex) => {
                                                            return <Checkbox value={details.code} >
                                                                {this.displayData(details)}
                                                            </Checkbox>
                                                        })
                                                    }
                                                </Checkbox.Group>
                                                )}
                                            </FormItem>
                                        </Col>
                                    }
                                    else if (item.type == "D") {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 12} style={{ marginTop: '-10px' }}>
                                            <FormItem {...radioLayout} label={this.displayData(item)}>
                                                {getFieldDecorator(item.code, {
                                                    initialValue: moment(moment().format("L"), 'YYYY-MM-DD'),
                                                })(
                                                    <DatePicker format='YYYY-MM-DD' style={{ width: '100%', margin: '-10px', marginLeft: '2px' }} disabledDate={(curDate) => {
                                                        return curDate && curDate > moment().endOf('day');
                                                    }} />
                                                )}
                                            </FormItem>
                                        </Col>
                                    }
                                    else {
                                        return <Col key={itemIndex} span={(item.singleLine == "Y") ? 24 : 6}>
                                            {this.displayData(item)}
                                        </Col>
                                    }
                                }

                            })
                        }
                    </div>
                </Form>
            )
            const mesIcon = <Icon type="exclamation-circle" />
            let { EN, CN, patInfo, baseParms, province, firstCity, presentCity, presentAreas, presentVillages, presentHamlets } = this.state;
            let firstCityItem = [], presentCityItem = []; //省,市Option
            let presentVillagesItem = [];//乡
            let presentHamletsItem = [];//村
            let card = []
            baseParms.cardType && baseParms.cardType.map(item => {
                card.push(<Option key={item.id} disabled={item.disabled ? true : false} data={item} value={String(item.id)}>{item.descripts}</Option>)
            })
            let provinceItem = [];
            province && province.map(item => {
                provinceItem.push(<Option key={item.id} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
            });

            //第一次加载的城市;
            firstCity && firstCity.map(item => {
                firstCityItem.push(<Option provinceid={item.province} zip={item.zipCode} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
            });

            //现住址
            if ((!presentCity) || (presentCity.length === 0)) {
                //籍贯城市下拉数据为空时加载所有城市
                presentCityItem = firstCityItem;
            } else {
                presentCity && presentCity.map(item => {
                    presentCityItem.push(<Option provinceid={item.province} key={item.id} zip={item.zipCode} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
                });
            }
            var presentAreasItem = []
            presentAreas && presentAreas.map(item => {
                presentAreasItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} zip={item.zipCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            if ((presentAreas) && (presentAreas.length === 0) && (patInfo.areaID)) {
                presentAreasItem.push(<Option key={patInfo.areaID} role={patInfo.areaDesc} title={patInfo.areaDesc} value={String(patInfo.areaID)}>{patInfo.areaDesc}</Option>)
            }
            if ((presentAreas) && (presentAreas.length === 0) && (this.state.areaDesc)) {
                presentAreasItem.push(<Option key={this.state.areaID} role={this.state.areaDesc} title={this.state.areaDesc} value={String(this.state.areaDesc)}>{this.state.areaDesc}</Option>)
            }
            presentVillages && presentVillages.map(item => {
                presentVillagesItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} zip={item.zipCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            if ((presentVillages) && (presentVillages.length === 0) && (patInfo.villageID)) {
                presentVillagesItem.push(<Option key={patInfo.villageID} role={patInfo.villageDesc} title={patInfo.villageDesc} value={String(patInfo.villageID)}>{patInfo.villageDesc}</Option>)
            }
            if ((presentVillages) && (presentVillages.length === 0) && (this.state.villageDesc)) {
                presentVillagesItem.push(<Option key={this.state.villageID} role={this.state.villageDesc} title={this.state.villageDesc} value={String(this.state.villageDesc)}>{this.state.villageDesc}</Option>)
            }
            presentHamlets && presentHamlets.map(item => {
                presentHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} zip={item.zipCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            if ((presentHamlets) && (presentHamlets.length === 0) && (patInfo.hamletID)) {
                presentHamletsItem.push(<Option key={patInfo.hamletID} role={patInfo.hamletDesc} title={patInfo.hamletDesc} value={String(patInfo.hamletID)}>{patInfo.hamletDesc}</Option>)
            }
            if ((presentHamlets) && (presentHamlets.length === 0) && (this.state.hamletID)) {
                presentHamletsItem.push(<Option key={this.state.hamletID} role={this.state.hamletDesc} title={this.state.hamletDesc} value={String(this.state.hamletID)}>{this.state.hamletDesc}</Option>)
            }

            let credTypeItem = [];
            //证件类型
            baseParms.credType && baseParms.credType.map(item => {
                credTypeItem.push(<Option key={item.id} value={String(item.id)} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
            });
            return (
                <Modal
                    width='70%'
                    height="682px"
                    title="传染病上报"
                    visible={this.state.visible}
                    onCancel={this.handleCancel1}
                    footer={null}
                    className="Infection-title"
                >
                    <div className="Infection-opertion">
                        <Row style={{ width: '100%', textAlign: 'center', lineHeight: '45px' }}>
                            <PatientInfo admID={!Util.isEmpty(infectionsData) && !Util.isEmpty(infectionsData.admID) ? this.state.infectionsData.admID : (patientData && patientData.admID ? patientData.admID : '')} />
                        </Row>
                        <div className="content">
                            <Row>
                                <div style={{ overflowX: 'hidden', height: store.getState().tableHeight.y - 61 + 'px', overflowY: 'auto' }}>
                                    <Form>
                                        <div className="">
                                            <Row style={{ width: '100%', padding: '18px 18px 0 0' }}>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelReportUnit != null ? languageObj.InfectiousModelReportUnit.descripts : ""}>
                                                        {getFieldDecorator('hospDesc', {
                                                            initialValue: patInfo.hospDesc ? patInfo.hospDesc : userData.hospDesc,
                                                        })(
                                                            <Input disabled />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelCardDoctor != null ? languageObj.InfectiousModelCardDoctor.descripts : ""}>
                                                        {getFieldDecorator('hospDesc', {
                                                            initialValue: patInfo.reportUser ? patInfo.reportUser : userData.userName,
                                                        })(
                                                            <Input disabled />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelContactPhone != null ? languageObj.InfectiousModelContactPhone.descripts : ""}>
                                                        {getFieldDecorator('contactPhone', {
                                                            initialValue: patInfo.contactPhone ? patInfo.contactPhone : this.state.contactPhone,
                                                            rules: [{ required: true, message: '请填写', },
                                                            { pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的联系电话' }
                                                            ],
                                                            getValueFromEvent: (event) => {
                                                                return event.target.value.replace(/\D/g, '')
                                                            },
                                                        })(
                                                            <Input
                                                                maxLength={11}
                                                                onFocus={this.onFocus.bind(this, "contactPhone")}
                                                            />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelDateCard != null ? languageObj.InfectiousModelDateCard.descripts : ""}>
                                                        {getFieldDecorator('reportDate', {
                                                            initialValue: patInfo.reportDate ? moment(patInfo.reportDate, 'YYYY-MM-DD') : moment(),
                                                        })(
                                                            <DatePicker disabled style={{ width: '100%' }} disabledDate={(curDate) => {
                                                                return curDate && curDate > moment().endOf('day');
                                                            }} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelStatus != null ? languageObj.InfectiousModelStatus.descripts : ""}>
                                                        {getFieldDecorator('statusDesc', {
                                                            initialValue: patInfo.statusDesc ? patInfo.statusDesc : undefined,

                                                        })(
                                                            <Input disabled allowClear />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelReportCDC != null ? languageObj.InfectiousModelReportCDC.descripts : ""}>
                                                        {getFieldDecorator('reportCDC', {
                                                            initialValue: patInfo.reportCDCDesc ? patInfo.reportCDCDesc : undefined,

                                                        })(
                                                            <Input disabled allowClear />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row className="form-Infectious" style={{ width: '100%', padding: '18px 18px 0 0' }}>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelcredType != null ? languageObj.InfectiousModelcredType.descripts : ""}>
                                                        {getFieldDecorator('credTypeID', {
                                                            validateTrigger: ["onPressEnter", "onBlur"],
                                                            initialValue: patInfo.credTypeID ? patInfo.credTypeID : this.state.credTypeID ? this.state.credTypeID : this.state.credTypeID,
                                                            rules: [{ required: true, message: '请输入证件类型' }],
                                                        })(
                                                            <Select
                                                                showSearch
                                                                allowClear
                                                                optionFilterProp="role"
                                                                onChange={this.onCredTypeChange.bind(this, "credTypeID")}
                                                                onFocus={this.onFocus.bind(this, "credTypeID")}
                                                            >
                                                                {credTypeItem}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelcredNo != null ? languageObj.InfectiousModelcredNo.descripts : ""}>
                                                        {getFieldDecorator('credNo', {
                                                            initialValue: patInfo.credNo ? patInfo.credNo : this.state.credNo,
                                                            rules: [
                                                                { required: (this.state.contactCredNo === "") },
                                                                { validator: this.state.credTypeID == 1 ? Util.vailIdCard : "" },
                                                            ],
                                                            getValueFromEvent: (event) => {
                                                                return this.state.credTypeID == '1' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
                                                            },
                                                            //  rules: [{ required: true, message: '请输入证件号' }],

                                                        })(
                                                            <Input
                                                                ref={this.credNo}
                                                                allowClear={true}
                                                                onPressEnter={this.patCredNoTip}
                                                                onBlur={this.patCredNoTip}
                                                                maxLength={this.state.credTypeID == 1 ? 18 : 99}
                                                                onFocus={this.onFocus.bind(this, "credNo")}
                                                            />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelpatientPhone != null ? languageObj.InfectiousModelpatientPhone.descripts : ""}>
                                                        {getFieldDecorator('patientPhone', {
                                                            initialValue: patInfo.patientPhone ? patInfo.patientPhone : this.state.patientPhone,
                                                            rules: [{ required: true, message: '请填写患者电话', },
                                                            { pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的联系电话' }
                                                            ],
                                                            getValueFromEvent: (event) => {
                                                                return event.target.value.replace(/\D/g, '')
                                                            },
                                                        })(
                                                            <Input
                                                                maxLength={11}
                                                                onFocus={this.onFocus.bind(this, "patientPhone")}
                                                            />
                                                        )}
                                                    </FormItem>

                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelparentName != null ? languageObj.InfectiousModelparentName.descripts : ""}>
                                                        {getFieldDecorator('parentName', {
                                                            initialValue: patInfo.parentName ? patInfo.parentName : this.state.parentName,
                                                            rules: [{ required: this.state.parentFlag, message: '请输入家长姓名' }],

                                                        })(
                                                            <Input allowClear />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>

                                        </div>
                                        <div className="">
                                            <Row style={{ width: '100%' }}>
                                                <Col span={4}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModeladdress != null ? languageObj.InfectiousModeladdress.descripts : ""}>
                                                        {getFieldDecorator('provinceID', {
                                                            initialValue: patInfo.provinceID ? patInfo.provinceID : this.state.provinceID,
                                                            rules: [{ required: true, message: '请输入省' }],

                                                        })(
                                                            <Select
                                                                allowClear={true}
                                                                showSearch={true}
                                                                placeholder={languageObj.InfectiousModelprovince != null ? languageObj.InfectiousModelprovince.descripts : ""}
                                                                optionFilterProp="role"
                                                                onChange={this.onProvinceChange.bind(this, "present")}
                                                            >
                                                                {provinceItem}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={3} style={{ marginLeft: '10px' }}>
                                                    <FormItem label=''>
                                                        {getFieldDecorator('cityID', {
                                                            initialValue: patInfo.cityID ? patInfo.cityDesc : this.state.cityID,

                                                        })(
                                                            <Select
                                                                allowClear={true}
                                                                showSearch={true}
                                                                placeholder={languageObj.InfectiousModelcity != null ? languageObj.InfectiousModelcity.descripts : ""}
                                                                optionFilterProp="role"
                                                                onChange={this.onCityChange.bind(this, "present")}
                                                                onFocus={this.onCityFocus.bind(this, "provinceID", "presentCity")}
                                                            >
                                                                {
                                                                    presentCityItem
                                                                }
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={3} style={{ marginLeft: '10px' }}>
                                                    <FormItem label=''>
                                                        {getFieldDecorator('areaID', {
                                                            initialValue: patInfo.areaID ? patInfo.areaDesc : this.state.areaDesc,


                                                        })(
                                                            <Select
                                                                allowClear={true}
                                                                showSearch={true}
                                                                placeholder={languageObj.InfectiousModelarea != null ? languageObj.InfectiousModelarea.descripts : ""}
                                                                optionFilterProp="role"
                                                                onChange={this.onAreaChange.bind(this, "present")}
                                                                onFocus={this.onAreaFocus.bind(this, "cityID", "present")}
                                                            >
                                                                {presentAreasItem}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={3} style={{ marginLeft: '10px' }}>
                                                    <FormItem label=''>
                                                        {getFieldDecorator('villageID', {
                                                            initialValue: patInfo.villageID ? patInfo.villageDesc : this.state.villageDesc,

                                                        })(
                                                            <Select
                                                                allowClear={true}
                                                                showSearch={true}
                                                                placeholder={languageObj.InfectiousModelvillage != null ? languageObj.InfectiousModelvillage.descripts : ""}
                                                                optionFilterProp="role"
                                                                onChange={this.onVillageChange.bind(this, "present")}
                                                                onFocus={this.onVillageFocus.bind(this, "areaID", "present")}
                                                            >
                                                                {presentVillagesItem}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={3} style={{ marginLeft: '10px' }}>
                                                    <FormItem label=''>
                                                        {getFieldDecorator('hamletID', {
                                                            initialValue: patInfo.hamletID ? patInfo.hamletID : this.state.hamletID,

                                                        })(
                                                            <Select
                                                                allowClear={true}
                                                                showSearch={true}
                                                                placeholder={languageObj.InfectiousModelhamlet != null ? languageObj.InfectiousModelhamlet.descripts : ""}
                                                                optionFilterProp="role"
                                                                onFocus={this.onHamletFocus.bind(this, "villageID", "present")}
                                                            >
                                                                {presentHamletsItem}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={7} id="patAdress" className="presentAddressDescDom" style={{ marginLeft: '10px' }}>
                                                    <Tooltip
                                                        getPopupContainer={() => document.querySelector('#patAdress')}
                                                        // overlayClassName="toolTipDom patAd"
                                                        overlayClassName="toolTipDom topTips"
                                                        title={<div className="titleIcon">{mesIcon}<span >{this.state.tipsPresentAddressDesc}</span></div>} visible={this.state.tipsPresentAddressDesc !== ""}
                                                    >
                                                        <Form.Item className="addressTextBorder" label={""}  {...formItemLayoutAdd}>
                                                            {getFieldDecorator('address',
                                                                {
                                                                    rules: [{ required: true, message: '请填写详细地址' }],
                                                                    initialValue: patInfo.address ? patInfo.address : this.state.address,
                                                                })(
                                                                    <Input
                                                                        onBlur={this.onTipsItemBlur.bind(this, "address", "请填写现住址详细地址")}
                                                                        onPressEnter={this.onTipsItemBlur.bind(this, "address", "请填写现住址详细地址")}
                                                                        placeholder={languageObj.InfectiousModelFullAddress != null ? languageObj.InfectiousModelFullAddress.descripts : ""}
                                                                        onFocus={this.onFocus.bind(this, "address")}
                                                                    />
                                                                )}
                                                        </Form.Item>
                                                    </Tooltip>
                                                </Col>
                                            </Row>
                                            <Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelUnitSchool != null ? languageObj.InfectiousModelUnitSchool.descripts : ""}>
                                                        {getFieldDecorator('company', {
                                                            initialValue: patInfo.company ? patInfo.company : undefined,
                                                            rules: [{ required: true, message: '请输入单位(学校)' }],

                                                        })(
                                                            <Input allowClear />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelOCCU != null ? languageObj.InfectiousModelOCCU.descripts : ""}>
                                                        {getFieldDecorator('OCCU', {
                                                            initialValue: patInfo.OCCU ? patInfo.OCCU : undefined,
                                                            rules: [{ required: true, message: '请输入人群分类' }],

                                                        })(
                                                            <Select showSearch optionFilterProp="title" allowClear>
                                                                {this.state.occu.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelbelongTo != null ? languageObj.InfectiousModelbelongTo.descripts : ""}>
                                                        {getFieldDecorator('belongTo', {
                                                            initialValue: patInfo.belongTo ? patInfo.belongTo : undefined,
                                                            rules: [{ required: true, message: '请输入患者属于' }],

                                                        })(
                                                            <Select showSearch optionFilterProp="title" allowClear>
                                                                {this.state.belongTo.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelcase != null ? languageObj.InfectiousModelcase.descripts : ""}>
                                                        {getFieldDecorator('caseClassification', {
                                                            initialValue: patInfo.caseClassification ? patInfo.caseClassification : undefined,
                                                            rules: [{ required: true, message: '请输入病例分类' }],

                                                        })(
                                                            <Select showSearch optionFilterProp="title" allowClear>
                                                                {this.state.caseClass.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row gutter={12}>
                                                <Col style={{ float: 'left', paddingLeft: "110px", boxSizing: "border-box" }}>
                                                    <FormItem {...formItemLayoutCheck}>
                                                        {getFieldDecorator('acute', {
                                                            initialValue: patInfo.acute
                                                        })(
                                                            <Checkbox checked={patInfo.acute === 'Y' ? true : false} onChange={(even) => { this.acuteClick(even) }}>{languageObj.InfectiousModelacute != null ? languageObj.InfectiousModelacute.descripts : ""}</Checkbox>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
                                                    <FormItem  {...formItemLayoutCheck}>
                                                        {getFieldDecorator('chronic', {
                                                            initialValue: patInfo.chronic
                                                        })(
                                                            <Checkbox checked={patInfo.chronic === 'Y' ? true : false} onChange={(even) => { this.chronicClick(even) }}>{languageObj.InfectiousModelchronic != null ? languageObj.InfectiousModelchronic.descripts : ""}</Checkbox>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
                                                    <FormItem  {...formItemLayoutCheck}>
                                                        {getFieldDecorator('unclassified', {
                                                            initialValue: patInfo.unclassified
                                                        })(
                                                            <Checkbox checked={patInfo.unclassified === 'Y' ? true : false} onChange={(even) => { this.unclassifiedClick(even) }}>{languageObj.InfectiousModelunclassified != null ? languageObj.InfectiousModelunclassified.descripts : ""}</Checkbox>
                                                        )}
                                                    </FormItem>
                                                </Col>

                                            </Row>
                                            <Row className="form-Infectious" style={{ width: '100%', padding: '18px 18px 0 0' }}>
                                                <Col span={12}>
                                                    <FormItem {...formItemEquip} label={languageObj.InfectiousModeldisease != null ? languageObj.InfectiousModeldisease.descripts : ""}>
                                                        {getFieldDecorator('diseaseID', {
                                                            initialValue: patInfo.diseaseID ? patInfo.diseaseID : this.props.diseaseID,
                                                            rules: [{ required: true, message: '请输入传染病' }],

                                                        })(
                                                            <Select disabled={Util.isEmpty(this.props.reportID)} onChange={this.changeDisease} showSearch allowClear optionFilterProp="seatchprop">
                                                                {this.state.disease.map(data => (<Select.Option key={data.id} value={data.id} title={data.descripts} seatchprop={data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModeldiagDate != null ? languageObj.InfectiousModeldiagDate.descripts : ""}>
                                                        {getFieldDecorator('diagDate', {
                                                            initialValue: patInfo && patInfo.diagDate ? moment(patInfo.diagDate, 'YYYY-MM-DD') : moment(),
                                                            rules: [{ required: true, message: '请输入诊断日期' }],

                                                        })(
                                                            <DatePicker style={{ width: '100%' }} disabledDate={(curDate) => {
                                                                return curDate && curDate > moment().endOf('day');
                                                            }} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModeldiagTime != null ? languageObj.InfectiousModeldiagTime.descripts : ""}>
                                                        {getFieldDecorator('diagTime', {
                                                            initialValue: patInfo && patInfo.diagTime ? moment(patInfo.diagTime, 'HH:mm') : moment(),
                                                            rules: [{ required: true, message: '请输入诊断时间' }],

                                                        })(
                                                            <TimePicker
                                                                format="HH:mm"
                                                                showTime={{ defaultValue: moment('11:59', 'HH:mm') }}
                                                                style={{ width: '100%' }}
                                                            />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelonsetDate != null ? languageObj.InfectiousModelonsetDate.descripts : ""}>
                                                        {getFieldDecorator('onsetDate', {
                                                            initialValue: patInfo && patInfo.onsetDate ? moment(patInfo.onsetDate, 'YYYY-MM-DD') : moment(),
                                                            rules: [{ required: true, message: '请输入发病日期' }],

                                                        })(
                                                            <DatePicker style={{ width: '100%' }} disabledDate={(curDate) => {
                                                                return curDate && curDate > moment().endOf('day');
                                                            }} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6} >
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModelonsetTime != null ? languageObj.InfectiousModelonsetTime.descripts : ""}>
                                                        {getFieldDecorator('onsetTime', {
                                                            initialValue: patInfo && patInfo.onsetTime ? moment(patInfo.onsetTime, 'HH:mm') : moment(),
                                                            rules: [{ required: true, message: '请输入发病时间' }],

                                                        })(
                                                            <TimePicker
                                                                showTime={{ defaultValue: moment('11:59', 'HH:mm') }}
                                                                format="HH:mm"
                                                                style={{ width: '100%' }}
                                                            />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModeldieDate != null ? languageObj.InfectiousModeldieDate.descripts : ""}>
                                                        {getFieldDecorator('dieDate', {
                                                            initialValue: patInfo && patInfo.dieDate ? moment(patInfo.dieDate, 'YYYY-MM-DD') : null,
                                                            rules: [{ required: false, message: '请输入死亡日期' }],

                                                        })(
                                                            <DatePicker style={{ width: '100%' }} disabledDate={(curDate) => {
                                                                return curDate && curDate > moment().endOf('day');
                                                            }} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={6}>
                                                    <FormItem {...formItemLayout} label={languageObj.InfectiousModeldieTime != null ? languageObj.InfectiousModeldieTime.descripts : ""}>
                                                        {getFieldDecorator('dieTime', {
                                                            initialValue: patInfo && patInfo.dieTime ? moment(patInfo.dieTime, 'HH:mm') : null,
                                                            rules: [{ required: false, message: '请输入死亡时间' }],

                                                        })(
                                                            <TimePicker
                                                                showTime={{ defaultValue: moment('11:59', 'HH:mm') }}
                                                                format="HH:mm"
                                                                style={{ width: '100%' }}
                                                            />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
                                                <Col span={12} >
                                                    <FormItem {...formItemEquip} label={languageObj.InfectiousModelnotes != null ? languageObj.InfectiousModelnotes.descripts : ""}>
                                                        {getFieldDecorator('notes', {
                                                            initialValue: patInfo.notes ? patInfo.notes : undefined,
                                                            rules: [{ required: true, message: '请输入备注' }],

                                                        })(
                                                            <Input allowClear />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </div>
                                        <div style={{ width: '100%' }} className={this.state.ttt ? 'aa' : ''}>
                                            {tablePanel}
                                        </div>

                                    </Form>
                                </div>
                            </Row>
                            <div className="form-Info-Accp" style={{ borderTop: '1px solid #E5e5e5', padding: '15px 0 0 0' }}>
                                <br />
                                <Row type="flex" justify="center">
                                    <Col span={2} style={{ margin: '0 8px', display: ((this.state.btn5.indexOf(this.state.statusCode) > -1) && (locType == 'M')) ? '' : 'none' }}>
                                        <Button
                                            id="btn5"
                                            style={{ marginLeft: '-15px' }}
                                            className="btn-botton"
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'pending')}
                                        >
                                            {/* 取消审核 */}
                                            {languageObj.InfectiousModelCancelAudit != null ? languageObj.InfectiousModelCancelAudit.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 10px', display: this.state.btn6.indexOf(this.state.statusCode) > -1 ? '' : 'none' }}>
                                        <Button
                                            id="btn6"
                                            className="btn-botton"
                                            style={{ marginLeft: '-15px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'revise')}
                                        >
                                            {/* 订正 */}
                                            {languageObj.InfectiousModelRevision != null ? languageObj.InfectiousModelRevision.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn7.indexOf(this.state.statusCode) > -1 && locType == 'M') ? '' : 'none' }}>
                                        <Button
                                            id="btn7"
                                            className="btn-botton"
                                            style={{ marginLeft: '-28px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'CDC')}
                                        >
                                            {/* 上报CDC */}
                                            {languageObj.InfectiousModelReportCDC != null ? languageObj.InfectiousModelReportCDC.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 10px', display: this.state.btn8.indexOf(this.state.statusCode) > -1 ? '' : 'none' }}>
                                        <Button
                                            id="btn8"
                                            className="btn-botton"
                                            style={{ marginLeft: '-15px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'pending')}
                                        >
                                            {/* 重新报卡 */}
                                            {languageObj.InfectiousModelreportCard != null ? languageObj.InfectiousModelreportCard.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn1.indexOf(this.state.statusCode) > -1 && locType == 'M') ? '' : 'none' }}>
                                        <Button
                                            id="btn1"
                                            className="btn-botton"
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'reviewed')}
                                        >
                                            {/* 审核 */}
                                            {languageObj.InfectiousModelAudit != null ? languageObj.InfectiousModelAudit.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn2.indexOf(this.state.statusCode) > -1 && locType == 'M') ? '' : 'none' }}>
                                        <Button
                                            id="btn2"
                                            className="btn-botton"
                                            style={{ marginLeft: '-10px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'pending')}
                                        >
                                            {/* 保存修改 */}
                                            {languageObj.InfectiousModelsaveUpdate != null ? languageObj.InfectiousModelsaveUpdate.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn3.indexOf(this.state.statusCode) > -1 && locType == 'M') ? '' : 'none' }}>
                                        <Button
                                            id="btn3"
                                            className="btn-botton"
                                            style={{ marginLeft: '-4px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'return')}
                                        >
                                            {/* 退回 */}
                                            {languageObj.InfectiousModelreturn != null ? languageObj.InfectiousModelreturn.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn4.indexOf(this.state.statusCode) > -1 && locType == 'M') ? '' : 'none' }}>
                                        <Button
                                            id="btn4"
                                            className="btn-botton"
                                            style={{ marginLeft: '-15px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'void')}
                                        >
                                            {/* 作废 */}
                                            {languageObj.InfectiousModelvoid != null ? languageObj.InfectiousModelvoid.descripts : ""}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: this.state.btn9.indexOf(this.state.statusCode) > -1 ? '' : 'none' }}>
                                        <Button
                                            id="btn9"
                                            style={{ marginLeft: '-15px' }}
                                            className="btn-botton"
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'draft')}
                                        >
                                            {languageObj.InfectiousModeldraft != null ? languageObj.InfectiousModeldraft.descripts : ""}
                                            {/* 保存草稿 */}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: (this.state.btn10.indexOf(this.state.statusCode) > -1) ? '' : 'none' }}>
                                        <Button
                                            id="btn10"
                                            className="btn-botton"
                                            style={{ marginLeft: '-4px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'pending')}
                                        >
                                            {languageObj.InfectiousModelpending != null ? languageObj.InfectiousModelpending.descripts : ""}
                                            {/* 报卡 */}
                                        </Button>
                                    </Col>
                                    <Col span={2} style={{ margin: '0 8px 0 0', display: this.state.btn11.indexOf(this.state.statusCode) > -1 ? '' : 'none' }}>
                                        <Button
                                            id="btn11"
                                            className="btn-botton"
                                            style={{ marginLeft: '-15px' }}
                                            type='primary'
                                            htmlType="submit"
                                            onClick={this.handleSubmit.bind(this, 'othReported')}
                                        >
                                            {/* {languageObj.InfectiousModelReported!= null ? languageObj.InfectiousModelReported.descripts : ""} */}
                                            外院已报
                                        </Button>
                                    </Col>
                                    {this.props.statusID != "notReproted" ? (<div>
                                        <Col span={2} style={{ margin: '0 8px 0 0' }}>
                                            <Button
                                                className="btn-botton"
                                                type='primary'
                                                htmlType="submit"
                                                onClick={this.printReport}
                                            >
                                                {/* {languageObj.InfectiousModelvprint != null ? languageObj.InfectiousModelprint.descripts : ""} */}
                                                打印
                                            </Button>
                                        </Col>
                                    </div>) : ""}
                                </Row>
                            </div>
                        </div>
                    </div>
                </Modal>
            )
        }
    }
)

export default InfectiousModel;
