import axios from '@utils/ajax';
import store from '@store';
import { getHospitalPacList,getHospitalPacDetailList } from '../actions/wrapModalBodyPac';
export const getImportLists = (data) => {
  const state = store.getState();
  const patientInfo = state.patInfo.message;
    let param = {
      "endTime": data.endTime,
      "startTime": data.startTime,
      "hospitalCode": patientInfo.hospitalCode,
      "inquiryCode": patientInfo.recordId,
      "patientId": patientInfo.patientId,
    }
    return (dispatch) => {
        axios.json('/dockingImport/pacsDockingImport',param)
        .then((res)=>{
            const data = res.data.data;
            let tmpObj = {}
            tmpObj.name = data.name
            tmpObj.patientNum = data.patientNum
            dispatch(getHospitalPacList(data.pacsRetrieveData,tmpObj))
        })
    }
};
export const getSonDetailList = (name,time) => {
  return (dispatch) => {
      axios.json('/dockingImport/getByCheckItemPacsData',{checkItem:name})
      .then((res)=>{
          const data = res.data.data;
          data.Rtime = time
          dispatch(getHospitalPacDetailList(data,name))
      })
  }
};