import React from 'react';
import {
  connect
} from 'react-redux';
import WrapModalBody from '@components/WrapModalBody';
import {
  getSearchList,
  getImportList,
  getSonDetailLists
} from '@store/async-actions/wrapModalBody';
import {
  allCheckImportIns,
  selectOneCheck,
  selectWaring,
  showInIcss
} from '@store/actions/wrapModalBody';

function mapStateToProps(state) {
  return {
    message: state.patInfo.message,
    hospitalMsg: state.homePage.sysConfig || {},
    hospitalInspect: state.wrapModalBody.hospitalInspect || [],
    hospitalSonInspect: state.wrapModalBody.hospitalInspectObj || [],
    allCheck: state.wrapModalBody.allCheck,
    selectGroupList: state.wrapModalBody.selectGroupList,
    checkedList: state.wrapModalBody.checkedList,
    btnMsg: state.wrapModalBody.btnMsg,
  }
}

function mapDispatchToProps(dispatch, store) {
  return {
    showInIcss(){
      dispatch(showInIcss())
    },
    selectWaring(){
      dispatch(selectWaring())
    },
    selectOneCheck(name,groupName,item){
      dispatch(selectOneCheck(name,groupName,item))
    },
    allCheckImportIns(data) {
      dispatch(allCheckImportIns(data))
    },
    handleSearch(data) {
      dispatch(getImportList(data))
    },
    handleGetSonList(name,time) {
      dispatch(getSonDetailLists(name,time))
    },
    handleChangeValue(val) {
      dispatch(getSearchList(val))
    }
  }
}

const WrapModalBodyAction = connect(mapStateToProps, mapDispatchToProps)(WrapModalBody);

export default WrapModalBodyAction;